Skip to content
Merged
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
14 changes: 8 additions & 6 deletions beta-window-triage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ Implemented on beta per maintainer decisions (opt-in flag, prune-only, select-al
1. **[#5968](https://github.com/TanStack/table/issues/5968) (high) — land FIRST.** `memo` (`utils.ts:176-201`) has no first-run suppression, so the first `getRowModel()` schedules `table_autoResetExpanded`/`table_autoResetPageIndex` on mount, wiping controlled `expanded` and initial `pageIndex`. Also `table_autoResetPageIndex` calls `table_resetPageIndex(table, true)` (`rowPaginationFeature.utils.ts:49`), hard-coding 0 and ignoring `initialState`. Fix: restore first-run guard + drop the `true`.
2. **[#5801](https://github.com/TanStack/table/issues/5801) (med-high) — land SECOND, via PR [#6443](https://github.com/TanStack/table/pull/6443).** `table_autoResetExpanded` is only wired from the grouped row model; wire into `createCoreRowModel`. Landing this before the [#5968](https://github.com/TanStack/table/issues/5968) guard would extend the mount-wipe bug to all non-grouped tables.

### Cluster 3: Expanded/pagination state contents
### Cluster 3: Expanded/pagination state contents — FIX IMPLEMENTED 2026-08-02 (pending PR)

- **[#6115](https://github.com/TanStack/table/issues/6115) (med)** — expand-all materializes every id from `rowsById` including non-expandable rows (`rowExpandingFeature.utils.ts:263-266`), polluting serialized `ExpandedState` and skewing `getExpandedDepth`. Port [#6116](https://github.com/TanStack/table/pull/6116) approach; decide `row_getCanExpand` vs `subRows.length` semantics.
- **[#5833](https://github.com/TanStack/table/issues/5833) (med)** — paginated `flatRows` duplicates expanded sub-rows (`createPaginatedRowModel.ts:71-80` pushes then recurses into already-flattened rows). Changes `flatRows` contents; needs small semantic decision on collapsed descendants.
- **[#6136](https://github.com/TanStack/table/issues/6136) (low-med)** — `row.toggleExpanded(bool)` fires `onExpandedChange` on no-ops (`rowExpandingFeature.utils.ts:258`); controlled consumers get spurious callbacks. Port [#6184](https://github.com/TanStack/table/pull/6184) approach.
- **[#4939](https://github.com/TanStack/table/issues/4939) (med)** — imperative `row_toggleExpanded`/`toggleAllRowsExpanded` never consult `row_getCanExpand`, unlike the selection twin. Guard turns currently-succeeding calls into no-ops.
All four implemented on beta in one coordinated change (`rowExpandingFeature.utils.ts` + `createPaginatedRowModel.ts`), with new unit/implementation tests, all-frameworks expanding-guide note, and changeset `expanding-pagination-state-contents`:

- **[#6115](https://github.com/TanStack/table/issues/6115)** — expand-all materialization (`row_toggleExpanded` old===true branch) now only writes ids where `row_getCanExpand` is true (chosen over `subRows.length` so `getRowCanExpand` lazy-load overrides stay expandable). `table_getExpandedDepth` filters the same way for expanded-all. Companion: `table_getIsAllRowsExpanded` now only considers expandable rows so the materialized map still round-trips as "all expanded" (stale-ids-with-no-expandable-rows returns false).
- **[#5833](https://github.com/TanStack/table/issues/5833)** — paginated `flatRows` rebuild dedupes via seen-id set. Semantic decision: collapsed descendants of page rows stay included (consistent with every other row model where `flatRows` ignores expansion state); only the duplication is removed.
- **[#6136](https://github.com/TanStack/table/issues/6136)** — `row_toggleExpanded` early-returns (no `onExpandedChange`) when the target state matches current atom state; `table_toggleAllRowsExpanded` gets symmetric no-op guards (already `true`, or collapse with nothing expanded).
- **[#4939](https://github.com/TanStack/table/issues/4939)** — expand direction of `row_toggleExpanded` now guarded on `row_getCanExpand`; `table_toggleAllRowsExpanded` expand branch guarded on `table_getCanSomeRowsExpand`. Collapse always allowed (stale-id cleanup). Angular/ember flex-render tests that drove expansion on flat rows updated with `getRowCanExpand: () => true`.

### Cluster 4: Sorting defaults

Expand Down Expand Up @@ -110,6 +112,6 @@ Implemented on beta per maintainer decisions (opt-in flag, prune-only, select-al
4. **[#6313](https://github.com/TanStack/table/pull/6313)** rebase + merge ([#6007](https://github.com/TanStack/table/issues/6007)); **[#6361](https://github.com/TanStack/table/pull/6361)** fix CI + merge ([#5987](https://github.com/TanStack/table/issues/5987)); **[#6443](https://github.com/TanStack/table/pull/6443)** rebase + merge ([#5801](https://github.com/TanStack/table/issues/5801)).
5. `_valuesCache`/`defaultColumn` invalidation pair ([#5363](https://github.com/TanStack/table/issues/5363)/[#4485](https://github.com/TanStack/table/issues/4485) + [#5275](https://github.com/TanStack/table/issues/5275)).
6. Sorting defaults ([#4946](https://github.com/TanStack/table/issues/4946) one-liner; [#5147](https://github.com/TanStack/table/issues/5147)/[#5832](https://github.com/TanStack/table/issues/5832) auto-dir sampling).
7. Remaining semantics decisions: [#5909](https://github.com/TanStack/table/issues/5909) (undefined = uncontrolled), [#5778](https://github.com/TanStack/table/issues/5778), [#6115](https://github.com/TanStack/table/issues/6115), [#5833](https://github.com/TanStack/table/issues/5833), [#6101](https://github.com/TanStack/table/issues/6101), [#6081](https://github.com/TanStack/table/issues/6081), [#4939](https://github.com/TanStack/table/issues/4939), [#6136](https://github.com/TanStack/table/issues/6136).
7. Remaining semantics decisions: [#5909](https://github.com/TanStack/table/issues/5909) (undefined = uncontrolled), [#5778](https://github.com/TanStack/table/issues/5778), [#6101](https://github.com/TanStack/table/issues/6101), [#6081](https://github.com/TanStack/table/issues/6081). (Cluster 3 — [#6115](https://github.com/TanStack/table/issues/6115), [#5833](https://github.com/TanStack/table/issues/5833), [#4939](https://github.com/TanStack/table/issues/4939), [#6136](https://github.com/TanStack/table/issues/6136) — implemented 2026-08-02, pending PR.)
8. Type changes batch: [#5908](https://github.com/TanStack/table/issues/5908), [#5971](https://github.com/TanStack/table/issues/5971), [#6302](https://github.com/TanStack/table/issues/6302) (TS-perf gate).
9. [#6078](https://github.com/TanStack/table/issues/6078) via corrected [#6445](https://github.com/TanStack/table/pull/6445) (urgent but non-breaking — do not let it slip just because it is "anytime").
2 changes: 1 addition & 1 deletion docs/framework/alpine/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/angular/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/ember/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/lit/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/octane/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/preact/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/react/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/solid/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/svelte/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
2 changes: 1 addition & 1 deletion docs/framework/vue/guide/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ If not specified, the default value for `sortUndefined` is `1`, and undefined va

- `'first'` - Undefined values will be pushed to the beginning of the list
- `'last'` - Undefined values will be pushed to the end of the list
- `false` - Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- `false` - Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1` - Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1` - Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)

Expand Down
6 changes: 5 additions & 1 deletion docs/reference/index/interfaces/ColumnDef_RowSorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ Defined in: [features/row-sorting/rowSortingFeature.types.ts:153](https://github

The priority of undefined values when sorting this column.
- `false`
- Undefined values will be considered tied and need to be sorted by the next column filter or original index (whichever applies)
- Undefined values will be passed to the sorting function like any other value with no special handling; the sorting function is responsible for handling them
- `-1`
- Undefined values will be sorted with higher priority (ascending) (if ascending, undefined will appear on the beginning of the list)
- `1`
- Undefined values will be sorted with lower priority (descending) (if ascending, undefined will appear on the end of the list)
- `'first'`
- Undefined values will be pushed to the beginning of the list regardless of sort direction
- `'last'`
- Undefined values will be pushed to the end of the list regardless of sort direction
14 changes: 11 additions & 3 deletions docs/reference/index/interfaces/Column_RowSorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,20 @@ Reads this column's current sort direction, or `false` when unsorted.
### getNextSortingOrder()

```ts
getNextSortingOrder: () => false | SortDirection;
getNextSortingOrder: (multi?) => false | SortDirection;
```

Defined in: [features/row-sorting/rowSortingFeature.types.ts:191](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-sorting/rowSortingFeature.types.ts#L191)
Defined in: [features/row-sorting/rowSortingFeature.types.ts:193](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-sorting/rowSortingFeature.types.ts#L193)

Returns the next sorting order.
Returns the next sorting order. Pass `multi` to resolve the order for a
multi-sort toggle, where `enableMultiRemove` governs whether the cycle can
remove the sort.
Comment on lines +142 to +144

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Document the global removal setting as well.

enableSortingRemoval remains the global removal gate in column_getNextSortingOrder; enableMultiRemove adds a multi-sort-specific restriction. Update this text so readers do not assume enableMultiRemove alone controls removal.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/index/interfaces/Column_RowSorting.md` around lines 142 - 144,
Update the documentation for column_getNextSortingOrder to state that
enableSortingRemoval is the global gate for removing sorting, while
enableMultiRemove applies the additional restriction for multi-sort toggles.


#### Parameters

##### multi?

`boolean`

#### Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ function column_getAutoSortDir<TFeatures, TData, TValue>(column): "asc" | "desc"

Defined in: [features/row-sorting/rowSortingFeature.utils.ts:154](https://github.com/TanStack/table/blob/main/packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts#L154)

Chooses the default first sort direction from the first filtered row value.
Chooses the default first sort direction from sampled filtered row values.

String columns start ascending so alphabetical order is natural; other value
types start descending.
The first non-nullish value among the sampled rows decides: string columns
start ascending so alphabetical order is natural; other value types (or
columns with no non-nullish sample) start descending. Sampling past leading
nullish values keeps the toggle cycle stable when sorting or a data swap
moves an empty value into the first row.

## Type Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Defined in: [features/row-sorting/rowSortingFeature.utils.ts:221](https://github
Applies the next sorting state for this column.

The toggle can add, replace, flip, or remove this column's sort entry. Multi
sorting respects `enableMultiSort`, `maxMultiSortColCount`, and the `multi`
argument.
sorting respects `enableMultiSort`, `enableMultiRemove`,
`maxMultiSortColCount`, and the `multi` argument.

## Type Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({

const handleStartEditMode = (event: MouseEvent) => {
event.stopPropagation()
setEditingRow({ ...row })
setEditingRow(row)
}

const showEditActionButtons =
Expand Down
Loading
Loading