[6.x] Upgrade TanStack Table to v9 - #19718
Merged
Merged
Conversation
Moves @tanstack/vue-table and @tanstack/table-core from 8.21.3 to 9.2.4. - Register a shared feature set (craftTableFeatures) for every CP table, since v9 only exposes a feature's APIs to tables that register it - useVueTable -> useTable, drop getCoreRowModel, read state via atoms - Add the feature-set generic to column helpers, types and ColumnMeta - Make AdminTable/BaseElementIndex/DataTable generic over the row type, as v9 tables are invariant in their data type - Keep the select-all checkbox from showing indeterminate when every row is selected (getIsSomeRowsSelected now includes the all-selected case) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add useCraftTable (createTableHook) with the shared features and defaults, replacing per-table `features` wiring - Default to enableSorting: false; useServerSort opts tables back in. Tables with no sorting wired up no longer show sort buttons that did nothing - Type column meta through a columnMeta slot instead of global declaration merging - Use createCraftColumnHelper everywhere and the FlexRender shorthand Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📚 Storybook previews@craftcms/ui — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
# Conflicts: # resources/js/common/components/DataTable.vue
brianjhanson
marked this pull request as ready for review
October 1, 2026 14:25
# Conflicts: # resources/js/modules/forms/nested-elements/NestedElementBlocksControl.vue
|
This PR had conflicts with Claude's response
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades
@tanstack/vue-tableand@tanstack/table-corefrom 8.21.3 to 9.2.4, then moves CP tables onto v9'screateTableHook.Upgrade (
0b2a1e59e0)v9 is a breaking rewrite:
DataTable/BaseElementIndex, which use all of them, so every table registers the same set: column ordering/sizing/visibility plus row pagination/selection/sorting. No client-side row models are registered, since sorting and pagination happen on the server.useVueTable→useTable;getCoreRowModelis gone;table.getState().x→table.atoms.x.get(). Our getter-baseddata/stateoptions are still tracked reactively by the v9 Vue adapter.getIsSomeRowsSelected()now includes the all-selected case, so the header checkbox also checks!getIsAllRowsSelected()before showing as indeterminate.Table<any>no longer accepts every table), soAdminTable,BaseElementIndexandDataTableare now generic overTData extends Record<string, any>. Stories and one test use the repo's existing casts for generic SFCs.RowSelectionStateis nowRecord<string, true>;useAssetFolderActionsnarrowsfolderNamenow that the active index table has its real row type.createTableHookrefactor (4ef0d51ba1)modules/admin-table/craftTable.tsexportsuseCraftTable, so a table only passes{ data, columns, … }.useServerSortswitches it back on. The user groups, plugins, migrations and queue manager tables showed sort buttons that flipped the arrow but never reordered rows (the same in v8); those buttons are now gone. Tables that do sort are unaffected.columnMetaslot instead of global declaration merging inglobals.d.ts.createCraftColumnHelperis used everywhere;DataTableuses the<FlexRender :header>/:cellshorthand.Testing
pnpm typecheck: 0 errors.pnpm lint:js: warnings only, none on changed lines.pnpm test: 1084 pass, 12 fail. The 12 failures are in 5 files that don't use tables (upload client, ElementSelectControl, dashboard widget settings, NewEntryButton, WorkflowStagesInput), and the same tests fail on an untouched6.xcheckout.craftTable.test.tscovers the sorting default and the server-sort opt-in.🤖 Generated with Claude Code