-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix ordering of pmc after subtree update. #2388
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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.
I can't quite put my finger on it, but I think there's a situation here where either the index you end up inserting at isn't what it should be anymore, or the item looks new - so gets put at the end instead of in the middle - but it's just a modification of the old item.
What I think we implicitly really want is for
objs[keystr]
to wind up sorted by path (ie in increasing value of the first item in the path that differs between any two elements). And if I'm reading this correctly, the only case in which this matters is when we saved some of the old paths (line 35 above) and added more items with the samekeyStr
here.So perhaps we could do something like save a record of which
keyStr
's (oldKeys
) we pre-populated above, then when we get here if we find akeyStr
in that set we insert the new item in the list before the first item with a later path, if any; otherwise we push the new item on the end.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.
I am not sure there is way currently to trigger the situation you are describing, the issue this fix is that the fix for pattern matching callback with component as props reevaluate paths of the parent of the prop and thus was updating the existing pmc indexes. Otherwise currently the subtree is updated entirely from the callback and evaluated properly.
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.
OK - I can't construct one either. Maybe partial props will expose something new... we'll see. Just keep this in mind as we go along in case any new bug reports pop up!