Skip to content

Commit

Permalink
Merge branch 'fix/selection-row-count-bug-for-infinite' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Oct 21, 2024
2 parents 06bdb4d + 9d42180 commit ff468b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/react-formiga-table",
"version": "1.9.0-alpha.2",
"version": "1.8.2",
"engines": {
"node": "20.5.0"
},
Expand Down
19 changes: 15 additions & 4 deletions src/components/InfiniteTable/InfiniteTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,21 @@ const InfiniteTableComp = forwardRef<InfiniteTableRef, InfiniteTableProps>(
const selectedKeys = allSelectedNodes.map(
(node: { data: any }) => node.data.id,
);
onRowSelectionChange?.([
...selectedKeys,
...rowKeysInSelectedRowKeysButNotInAllNodes,
]);

const finalSelectedKeys = Array.from(
new Set([
...selectedKeys,
...rowKeysInSelectedRowKeysButNotInAllNodes,
]),
);

const hasSelectionChanged =
finalSelectedKeys.length !== selectedRowKeys.length ||
finalSelectedKeys.some((key) => !selectedRowKeys.includes(key));

if (hasSelectionChanged) {
onRowSelectionChange?.(finalSelectedKeys);
}
},
[getAllNodeKeys, onRowSelectionChange, selectedRowKeys],
);
Expand Down

0 comments on commit ff468b3

Please sign in to comment.