-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Rendered markup roots should be added to ReactMount node cache #2365
Comments
@syranide what would be a good test case to exercise this logic? |
I am not sure I understand what you meant originally, but I think #4983 fixes this. In any event, this is not really a "good first bug". |
Oh, I see. I think this is slightly separate then. I'll probably get to fixing this soon though. |
@spicyj FYI, IIRC this is not currently a very big issue as |
@spicyj I concur it's a tad beyond the beginner level 😅 |
@spicyj I'm thinking this is no longer relevant for the new renderer? Or is it still perhaps? |
Yeah I got rid of all this! It should be a lot easier to reason about now. |
ReactMount caches all children for each parent it visits, this avoids worst-case exponential cost. However, use of ReactDOMIDOperations for updates forces ReactMount to populate the cache with the previous children.
If a newly rendered node needs to be found, then "the children of the parent" of "the newly rendered root" has to be re-traversed as it does not exist in the node cache. Since it's guaranteed that all the siblings of newly rendered roots are cached and that we have a reference to the node, it's trivial to manually add it to the node cache which should avoid "double-traversals" entirely.
The text was updated successfully, but these errors were encountered: