You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: include feature default options in useTable's table.options - #6668
useTable returned options: tableOptions, which overrode the resolved options already spread from ...table, so defaults from getDefaultTableOptions (e.g. columnResizeMode: 'onEnd') were missing on the hook's table but present on row.table. It now returns { ...table.options, ...tableOptions }. tableOptions is still read inside the memo, so the deps stay [table, tableOptions, state] and the returned object still only changes when the caller's options do. Using coreTable.options as suggested in the issue trips react-hooks/exhaustive-deps, and disabling that rule makes the React Compiler lint skip the hook, so I went with this.
Same change in preact-table and octane-table, which had the same pattern. Added a test to react-table and preact-table (fails before, passes after). octane-table has no useTable unit tests, so it's only the source change there.
Ran vitest, eslint and tsc for react-table and preact-table, and vitest for octane-table. I didn't run the full pnpm test / pnpm test:e2e.
No actionable comments were generated in the recent review.
Walkthrough
The React, Preact, and Octane useTable adapters now return options that include feature defaults while preserving caller-supplied values. React and Preact tests check the default and explicit columnResizeMode values. A changeset declares patch releases for all three packages.
The three adapters merge table.options with caller-supplied tableOptions, which take precedence. React and Preact tests verify that columnResizeMode defaults to onEnd and reflects an explicit onChange value. The changeset declares patch releases for the three packages.
useTable now exposes feature defaults in table.options while still honoring caller-provided options. The change is small and tested for React and Preact, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: useTable's table.options now includes feature default options from getDefaultTableOptions. It uses the fix: prefix and states the component and the affected field. The…
Description check
The description follows the template sections: Changes, Checklist, and Release Impact. The Changes section gives the cause, the fix, the deps reasoning, the adapters touched, and the tests added. The …
Linked Issues check
Issue #6667 requires that table.options from React useTable include feature defaults from getDefaultTableOptions, with user options taking precedence. The reviewed change in `packages/react-tabl…
Out of Scope Changes check
All changed files relate to the linked issue. The useTable source changes in react-table, preact-table, and octane-table implement the same fix. The react-table and preact-table test additions verif…
Full details: Title check
Explanation
The title names the main change: useTable's table.options now includes feature default options from getDefaultTableOptions. It uses the fix: prefix and states the component and the affected field. The changeset, source edits in the three adapters, and tests all match this title.
Full details: Description check
Explanation
The description follows the template sections: Changes, Checklist, and Release Impact. The Changes section gives the cause, the fix, the deps reasoning, the adapters touched, and the tests added. The unchecked box for pnpm test and pnpm test:e2e is stated in the text, with the reason that the full suite was not run. The checklist items are filled in consistently with the changeset that was added.
Full details: Linked Issues check
Explanation
Issue #6667 requires that table.options from React useTable include feature defaults from getDefaultTableOptions, with user options taking precedence. The reviewed change in packages/react-table/src/useTable.ts returns options: { ...table.options, ...tableOptions } inside the memo. table.options holds the resolved options after table_setOptions, so the defaults are kept. Spreading tableOptions last keeps caller overrides. The memo dependencies remain [table, tableOptions, state], so the identity behavior described in the issue is preserved. The PR adds a React regression test in packages/react-table/tests/useTable.test.tsx that checks the columnResizeMode default ('onEnd') and the caller override ('onChange'). The issue asks that other adapters be checked. The same change appears in packages/preact-table/src/useTable.ts (with a Preact test) and packages/octane-table/src/useTable.tsrx. Evidence comes from the PR summary and the stated diff; I did not inspect the source files directly. The Octane change has no unit test, which the PR states. The issue does not require one.
Full details: Out of Scope Changes check
Explanation
All changed files relate to the linked issue. The useTable source changes in react-table, preact-table, and octane-table implement the same fix. The react-table and preact-table test additions verify the fix. The changeset .changeset/use-table-resolved-options.md covers the three published packages affected by the fix. No unrelated feature, refactor, or configuration change appears in the summary. Evidence comes from the PR summary and the per-file summaries; I did not inspect the diff hunks directly.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
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
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.
🎯 Changes
Fixes #6667
useTablereturnedoptions: tableOptions, which overrode the resolved options already spread from...table, so defaults fromgetDefaultTableOptions(e.g.columnResizeMode: 'onEnd') were missing on the hook's table but present onrow.table. It now returns{ ...table.options, ...tableOptions }.tableOptionsis still read inside the memo, so the deps stay[table, tableOptions, state]and the returned object still only changes when the caller's options do. UsingcoreTable.optionsas suggested in the issue tripsreact-hooks/exhaustive-deps, and disabling that rule makes the React Compiler lint skip the hook, so I went with this.Same change in preact-table and octane-table, which had the same pattern. Added a test to react-table and preact-table (fails before, passes after). octane-table has no useTable unit tests, so it's only the source change there.
Ran vitest, eslint and tsc for react-table and preact-table, and vitest for octane-table. I didn't run the full
pnpm test/pnpm test:e2e.✅ Checklist
pnpm testandpnpm test:e2e, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit
useTablenow exposes resolved feature defaults intable.options, while preserving caller-supplied options when they override those defaults.