-
Notifications
You must be signed in to change notification settings - Fork 2.9k
BREAKING: refactor useTable to be composable
#24947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 5129090c2dedbaf91b8441898788413992c556e3 (build) |
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 1573 | 1556 | 5000 | |
| Button | mount | 1100 | 1067 | 5000 | |
| FluentProvider | mount | 1841 | 1789 | 5000 | |
| FluentProviderWithTheme | mount | 660 | 662 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 612 | 670 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 654 | 669 | 10 | |
| MakeStyles | mount | 2150 | 2119 | 50000 | |
| SpinButton | mount | 3069 | 3017 | 5000 |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit edf133a:
|
a06d38c to
3366f29
Compare
3366f29 to
382488a
Compare
| }; | ||
|
|
||
| export function useSelection<TItem>(options: UseSelectionOptions) { | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Would be nice to add a comment here explaining why this is not a big deal.
| }; | ||
|
|
||
| export function useSort<TItem>(options: UseSortOptions) { | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Would be nice to add a comment here explaining why this is not a big deal.
* master: (62 commits) chore(migrate-converged): add functionality to execute various v9 package file restructuring tasks (microsoft#24458) chore(react-dialog): updates stories (microsoft#25070) refactor Progress to remove label and description slots (microsoft#25067) fix(SplitButton): Remove borders from hover and pressed state in primary split buttons (microsoft#25059) chore(react-persona): Add vr, conformance, and unit tests (microsoft#25007) (docs): update Icon docs with examples (microsoft#24768) Split button/primary hc fix (microsoft#25066) chore(react-utilities): restricts trigger API types (microsoft#25044) Add utilities export @fluentui/style-utilities v8 (microsoft#25065) chore: migrate whole repo to webpack 5 (microsoft#24542) applying package updates BREAKING: refactor `useTable` to be composable (microsoft#24947) Added shims to shim packages (microsoft#25048) Add Progress SPEC (microsoft#24418) applying package updates chore(react-persona): Add bundle-size command for bundle-size fixtures (microsoft#25055) fix(Button): Remove margin added to buttons by Safari (microsoft#25052) fix: Menu triggers no longer take focus when they are mounted (microsoft#25016) chore: deletes react-trigger package (microsoft#25042) Fixed a minor typo: immmediately => immediately (microsoft#25036) ...
* BREAKING: refactor `useTable` to be composable * Add docs about eslint ignore
This PR refactors the
useTableAPI to be more composable. TheuseTablehook now accepts plugins that will modify/enhance the state.Due to typescript limitations, the state is completely typed on our side and any extension that's not an officially supported plugin will need to extend types in userland. The main benefit is that future features for the table can be more SOLID through the implementation of plugins.
The plugins in theory can be order dependent, however there is no plugin that has this limitation.
Current Behavior
All functionality was configured on the single
useTablehook.New Behavior
Functionality should be composed from the
useTablehook using other react hooks that are plugins for the table state. Unless the relevant hook plugin is used, the user will have default state which is essentially a more complexnoopPrototypes of other plugins such as pagination and column sizing can be found in #24944
Related Issue(s)
Fixes #24226