Skip to content

Commit 207f890

Browse files
Update packages/table-core/src/features/RowExpanding.ts
agree Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 88ea0e8 commit 207f890

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/table-core/src/features/RowExpanding.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,12 @@ export const RowExpanding: TableFeature = {
311311
}
312312

313313
if (exists && !expanded) {
314-
const currentExpandedState = table.getState().expanded as ExpandedStateList;
315-
const rowIds = Object.keys(currentExpandedState);
316-
const updatedExpandedState = rowIds.reduce((acc, rowId) => {
317-
if (!rowId.startsWith(row.id)) {
318-
acc[rowId] = !!(currentExpandedState[rowId]);
314+
return Object.keys(oldExpanded).reduce((acc, rowId) => {
315+
if (rowId !== row.id && !rowId.startsWith(row.id + '.')) {
316+
acc[rowId] = oldExpanded[rowId];
319317
}
320318
return acc;
321319
}, {} as ExpandedStateList);
322-
return updatedExpandedState;
323320
}
324321

325322
return old

0 commit comments

Comments
 (0)