From 072e8213f057ce7a093d4747e41f54cd2344cfc7 Mon Sep 17 00:00:00 2001 From: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:23:17 +0530 Subject: [PATCH] fix error while switching grouped by (#4843) --- web/core/hooks/use-multiple-select.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/core/hooks/use-multiple-select.ts b/web/core/hooks/use-multiple-select.ts index f6bb3df9a..b985a19dd 100644 --- a/web/core/hooks/use-multiple-select.ts +++ b/web/core/hooks/use-multiple-select.ts @@ -250,7 +250,7 @@ export const useMultipleSelect = (props: Props) => { const isGroupSelected = useCallback( (groupID: string) => { const groupEntities = entitiesList.filter((entity) => entity.groupID === groupID); - const totalSelected = groupEntities.filter((entity) => getIsEntitySelected(entity.entityID ?? "")).length; + const totalSelected = groupEntities.filter((entity) => getIsEntitySelected(entity?.entityID ?? "")).length; if (totalSelected === 0) return "empty"; if (totalSelected === groupEntities.length) return "complete"; return "partial"; @@ -359,7 +359,7 @@ export const useMultipleSelect = (props: Props) => { useEffect(() => { if (disabled) return; selectedEntityIds.map((entityID) => { - const isEntityPresent = entitiesList.find((en) => en.entityID === entityID); + const isEntityPresent = entitiesList.find((en) => en?.entityID === entityID); if (!isEntityPresent) { const entityDetails = getEntityDetailsFromEntityID(entityID); if (entityDetails) {