From b64fb256ee752be64996e76446a6823ca6939cbe Mon Sep 17 00:00:00 2001 From: francesco Date: Mon, 9 Dec 2024 19:25:49 +0100 Subject: [PATCH] Fix for selected entities in collection groups bug when sharing id --- .../EntityCollectionTable/EntityCollectionTable.tsx | 6 ++---- .../EntityCollectionView/EntityCollectionView.tsx | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/firecms_core/src/components/EntityCollectionTable/EntityCollectionTable.tsx b/packages/firecms_core/src/components/EntityCollectionTable/EntityCollectionTable.tsx index 14fa0a0e6..2dbb1a57c 100644 --- a/packages/firecms_core/src/components/EntityCollectionTable/EntityCollectionTable.tsx +++ b/packages/firecms_core/src/components/EntityCollectionTable/EntityCollectionTable.tsx @@ -88,8 +88,6 @@ export const EntityCollectionTable = function EntityCollectionTable(defaultSize ?? "m"); - const selectedEntityIds = selectedEntities?.map(e => e.id); - const updateSize = useCallback((size: CollectionSize) => { if (onSizeChanged) onSizeChanged(size); @@ -204,7 +202,7 @@ export const EntityCollectionTable = function EntityCollectionTable ); - }, [size, selectedEntityIds]); + }, [size]); const collectionColumns: VirtualTableColumn[] = (() => { const columnsResult: VirtualTableColumn[] = propertiesToColumns({ @@ -312,7 +310,7 @@ export const EntityCollectionTable = function EntityCollectionTable) => selectedEntityIds?.includes(entity.id) ?? false, [selectedEntityIds])} + highlightedRow={(entity: Entity) => Boolean(selectedEntities?.find(e => e.id === entity.id && e.path === entity.path))} tableController={tableController} onValueChange={onValueChange} onColumnResize={onColumnResize} diff --git a/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx b/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx index dfbd874d1..5a53f6577 100644 --- a/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx +++ b/packages/firecms_core/src/components/EntityCollectionView/EntityCollectionView.tsx @@ -482,7 +482,7 @@ export const EntityCollectionView = React.memo( frozen?: boolean }) => { - const isSelected = usedSelectionController.selectedEntities.map(e => e.id).includes(entity.id); + const isSelected = Boolean(usedSelectionController.selectedEntities.find(e => e.id == entity.id && e.path == entity.path)); const actions = getActionsForEntity({ entity,