-
Notifications
You must be signed in to change notification settings - Fork 2.9k
chore(react-menu): stop spreading props on state #24562
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
chore(react-menu): stop spreading props on state #24562
Conversation
|
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 2ff33bc:
|
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 0174dfc96d5ea925268fb3f51efaa6373ecabcc6 (build) |
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 1301 | 1299 | 5000 | |
| Button | mount | 959 | 946 | 5000 | |
| FluentProvider | mount | 1572 | 1567 | 5000 | |
| FluentProviderWithTheme | mount | 629 | 630 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 592 | 586 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 626 | 638 | 10 | |
| MakeStyles | mount | 1922 | 1925 | 50000 | |
| SpinButton | mount | 2591 | 2480 | 5000 |
|
@bsunderhus FYI CI is failing: |
I'm on it @layershifter , the fact that this doesn't pass this easily is one more argument to stop spreading |
d809283 to
f64ff62
Compare
f64ff62 to
2ff33bc
Compare
ling1726
left a comment
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.
yeah stricter typings for this are 🚀


As there's no easy way to force state in Typescript to be only the properties you've declared, it is possible to create a superset of
stateby spreadingpropson it. This creates unmapped properties on state being passed down the line, in the remote case state is spread on an element (hope this doesn't happen) this will generate undesired attributes on that element.A better alternative is to simply not spread
...propsintostate, instead redeclare properties required by state.Effective changes:
propsonstateMenuStatetypes stricter