chore(react-menu): stop spreading props on state#24562
Merged
bsunderhus merged 3 commits intomicrosoft:masterfrom Sep 5, 2022
Merged
chore(react-menu): stop spreading props on state#24562bsunderhus merged 3 commits intomicrosoft:masterfrom
bsunderhus merged 3 commits intomicrosoft:masterfrom
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:
|
Collaborator
📊 Bundle size reportUnchanged fixtures
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 0174dfc96d5ea925268fb3f51efaa6373ecabcc6 (build) |
Collaborator
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 |
Member
|
@bsunderhus FYI CI is failing: |
Contributor
Author
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
approved these changes
Sep 5, 2022
Contributor
ling1726
left a comment
There was a problem hiding this comment.
yeah stricter typings for this are 🚀
This was referenced Sep 21, 2022
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.


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