fix: Sync NODE_TO_INDEX and NODE_TO_PARENT on apply instead on render#5939
fix: Sync NODE_TO_INDEX and NODE_TO_PARENT on apply instead on render#5939delijah wants to merge 3 commits intoianstormtaylor:mainfrom
NODE_TO_INDEX and NODE_TO_PARENT on apply instead on render#5939Conversation
|
|
The main problem with updating On of the main focuses of my performance PR was reducing the number of weak map operations, which is why You could probably do the same thing at the |
|
Ah. I assumed inside |
Ideally, we would handle each operation type individually to determine whether Regarding that last point, it may be a good idea if we used |
In the same time you wrote your answer, i've create a new commit. Were you talking about something like that? Inpired by https://webreflection.medium.com/a-basic-weakmap-performance-hint-e33c14908dff |
|
Broadly, yes, although using |
6835592 to
098fa53
Compare
|
Nice. Ok, added the changes. But yes, the complex part will be finding out which paths are affected and also testing this logic. Will not have time for now to take care about this 😢 |
Not sure if i understand you correctly. What needs to be updated on |
That part of my comment was assuming that the weak maps were keyed on the node object, not the node key object. Since node objects are completely replaced when their or their descendant's value changes, any weak maps keyed on the node object need to be updated. That isn't necessary when keying on the key object. |
Description
This PR will keep
NODE_TO_INDEXandNODE_TO_PARENTin sync right after applying operations, instead of on render. This will make theDOMEditor.findPathfunction more reliable.Issue
Fixes: #5938
Context
Please have a look at the issue for more context.
Checks
yarn test.yarn lint. (Fix errors withyarn fix.)yarn start.)yarn changeset add.)