Skip to content

Commit

Permalink
Fix for selected entities in collection groups bug when sharing id
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Dec 9, 2024
1 parent 13331d1 commit b64fb25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re

const [size, setSize] = React.useState<CollectionSize>(defaultSize ?? "m");

const selectedEntityIds = selectedEntities?.map(e => e.id);

const updateSize = useCallback((size: CollectionSize) => {
if (onSizeChanged)
onSizeChanged(size);
Expand Down Expand Up @@ -204,7 +202,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
</EntityTableCell>
);

}, [size, selectedEntityIds]);
}, [size]);

const collectionColumns: VirtualTableColumn[] = (() => {
const columnsResult: VirtualTableColumn[] = propertiesToColumns({
Expand Down Expand Up @@ -312,7 +310,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
inlineEditing={inlineEditing}
cellRenderer={cellRenderer}
onEntityClick={onEntityClick}
highlightedRow={useCallback((entity: Entity<M>) => selectedEntityIds?.includes(entity.id) ?? false, [selectedEntityIds])}
highlightedRow={(entity: Entity<M>) => Boolean(selectedEntities?.find(e => e.id === entity.id && e.path === entity.path))}
tableController={tableController}
onValueChange={onValueChange}
onColumnResize={onColumnResize}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b64fb25

Please sign in to comment.