Repository navigation
Reject unrelated paths early in determineChangedProps #4103
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fafd040
Reject unrelated paths early in determineChangedProps
maoxor e6722d5
Add CHANGELOG entry for #4103
maoxor e128da8
Merge remote-tracking branch 'origin/dev' into fin-4103
T4rk1n 022cada
Reuse isPathOrDescendant and add children update scenario to baseline
T4rk1n c7176c6
Keep the CI-hardware baseline, add only the new scenario scaled to it
T4rk1n bec9371
Merge remote-tracking branch 'origin/dev' into merge-4103
T4rk1n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import {expect} from 'chai'; | ||
| import {before, describe, it} from 'mocha'; | ||
| import {selectDashProps} from '../src/wrapper/selectors'; | ||
|
|
||
| const leaf = {namespace: 'test_ns', type: 'Leaf', props: {}}; | ||
| const flagged = children => ({ | ||
| namespace: 'test_ns', | ||
| type: 'Listens', | ||
| props: {children} | ||
| }); | ||
|
|
||
| // The selector remembers the hashes it has seen in a module-level record, so | ||
| // each test uses its own child index to stay independent of the others. | ||
| const stateFor = (index, layoutHashes) => { | ||
| const children = []; | ||
| children[index] = flagged([leaf]); | ||
| return {layout: {props: {children}}, layoutHashes}; | ||
| }; | ||
|
|
||
| const select = (index, layoutHashes) => { | ||
| const path = ['props', 'children', index]; | ||
| const [, , hash, changedProps, renderType] = selectDashProps(path)( | ||
| stateFor(index, layoutHashes) | ||
| ); | ||
| return {hash, changedProps, renderType}; | ||
| }; | ||
|
|
||
| describe('selectDashProps with dashChildrenUpdate', () => { | ||
| before(() => { | ||
| window.test_ns = {Listens: {dashChildrenUpdate: true}, Leaf: {}}; | ||
| }); | ||
|
|
||
| it('sums its own hash and those of its first level children', () => { | ||
| const self = 'props,children,1'; | ||
| const {hash} = select(1, { | ||
| [self]: {hash: 1}, | ||
| [`${self},props,children`]: {hash: 10}, | ||
| [`${self},props,children,0`]: {hash: 100} | ||
| }); | ||
| expect(hash).to.equal(111); | ||
| }); | ||
|
|
||
| it('ignores deeper descendants and unrelated paths', () => { | ||
| const self = 'props,children,2'; | ||
| const {hash} = select(2, { | ||
| [self]: {hash: 1}, | ||
| [`${self},props,children,0,props,children`]: {hash: 10}, | ||
| 'props,children,3': {hash: 100}, | ||
| props: {hash: 1000} | ||
| }); | ||
| expect(hash).to.equal(1); | ||
| }); | ||
|
|
||
| it('does not mistake a sibling with the same prefix for a child', () => { | ||
| const self = 'props,children,4'; | ||
| const {hash, changedProps} = select(4, { | ||
| [self]: {hash: 1}, | ||
| 'props,children,40': {hash: 10}, | ||
| 'props,children,40,props,children': {hash: 100} | ||
| }); | ||
| expect(hash).to.equal(1); | ||
| expect(changedProps).to.deep.equal({}); | ||
| }); | ||
|
|
||
| it('reports the prop of an updated child only once', () => { | ||
| const hashes = {'props,children,5,props,children': {hash: 1}}; | ||
| expect(select(5, hashes)).to.deep.equal({ | ||
| hash: 1, | ||
| changedProps: {children: true}, | ||
| renderType: 'components' | ||
| }); | ||
| expect(select(5, hashes)).to.deep.equal({ | ||
| hash: 1, | ||
| changedProps: {}, | ||
| renderType: undefined | ||
| }); | ||
| }); | ||
|
|
||
| it('reports its own changed props and render type', () => { | ||
| const {hash, changedProps, renderType} = select(6, { | ||
| 'props,children,6': { | ||
| hash: 2, | ||
| changedProps: {value: 1}, | ||
| renderType: 'callback' | ||
| } | ||
| }); | ||
| expect(hash).to.equal(2); | ||
| expect(changedProps).to.deep.equal({value: 1}); | ||
| expect(renderType).to.equal('callback'); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
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.
No
baseline.jsonentry means only the 5000 msfail_msguards this scenario, and it runs at about 33 ms. Going back to the old scan (about 67 ms) would pass. The baseline ratio is normalized for machine speed (see "Updating the baseline" in.ai/PERFORMANCE.md), so a baseline made on your laptop is fine. Can you regenerate it and commit it here?