Skip to content

Commit c5f80b7

Browse files
committed
dont include rows that arent expandable
1 parent 02c203a commit c5f80b7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ export const RowExpanding: TableFeature = {
208208
})
209209
}
210210
}
211-
table.setExpanded = updater => table.options.onExpandedChange?.(updater)
211+
table.setExpanded = updater => {
212+
return table.options.onExpandedChange?.(updater)
213+
}
212214
table.toggleAllRowsExpanded = expanded => {
213215
if (expanded ?? !table.getIsAllRowsExpanded()) {
214216
table.setExpanded(true)
@@ -294,8 +296,11 @@ export const RowExpanding: TableFeature = {
294296
let oldExpanded: ExpandedStateList = {}
295297

296298
if (old === true) {
297-
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
298-
oldExpanded[rowId] = true
299+
const rowIds = table.getRowModel().rowsById
300+
Object.keys(rowIds).forEach(rowId => {
301+
if (rowIds[rowId]?.getCanExpand()) {
302+
oldExpanded[rowId] = true
303+
}
299304
})
300305
} else {
301306
oldExpanded = old

0 commit comments

Comments
 (0)