Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/every-parks-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/table-core': patch
---

Prevents non expandable rows from being added to the state when the old state was true
7 changes: 5 additions & 2 deletions packages/table-core/src/features/RowExpanding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,11 @@ export const RowExpanding: TableFeature = {
let oldExpanded: ExpandedStateList = {}

if (old === true) {
Object.keys(table.getRowModel().rowsById).forEach(rowId => {
oldExpanded[rowId] = true
const rowIds = table.getRowModel().rowsById
Object.keys(rowIds).forEach(rowId => {
if (rowIds[rowId]?.getCanExpand()) {
oldExpanded[rowId] = true
}
})
} else {
oldExpanded = old
Expand Down