-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Pure render for tree data, fixes React Canary useMemo/useState StrictMode #5835
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 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c9e7d13
Pure render for useTreeData
snowystinger ea85e9e
adjust some more calls
snowystinger 0257054
fix accumulation of build trees
snowystinger 86d3a0f
better readability
snowystinger 62a7fef
fix typo
snowystinger ca1545a
fix remaining broken tests
snowystinger c259466
revert canary testing changes
snowystinger ec10e60
fix lint
snowystinger 46304e6
updating naming and making things a bit easier to read
LFDanLu 173d02f
make sure a new map is always generated in insert for purity
LFDanLu 8377a7c
make useTreeData always use and return a new Map
LFDanLu 2103dd1
guard against empy array in remove
LFDanLu 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
fix remaining broken tests
- Loading branch information
commit ca1545a66450f256aa217ad11870d64b32dccd86
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
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.
won't this still result in originalMap being mutated?
buildTreeonly creates a new map ifaccis not provided, otherwise it reuses it.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.
not quite sure I follow here. We are passing originalMap here to buildTree to build the newMap for the
parentKey === nullcase. If we didn't create pass it, buildTree would create a new map that would then only have the new nodes that are being inserted here instead of the full modified tree map sincevaluesis just the new values being insertedmodifying the originalMap here shouldn't matter right since we are now storing the map in state and accessing the previous map inside the setState call?
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 here https://github.com/adobe/react-spectrum/pull/5835/files#diff-c1a25c31946ec151047ebc265b0f5cf0971d990a3407c0dd66b7beecb1be4b24R151 we mutate the map that gets passed into
buildTree, thereby mutating the map stored in state.