-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Add reference to parent instance for component instances #1934
Conversation
We want to keep React core explicitly independent of ReactDOM related code, but only ReactDOMComponent is supposedly interested in keeping track of its ReactDOMComponent parent (for performance reasons we want to avoid traversing through non-ReactDOMComponents). As it will only be used by our ReactMount and our synthetic event system. However, since I see two solutions:
|
2 sounds good. ReactDOMComponent code will eventually move behind the serialization/diff stage. |
@sebmarkbage Apparently I oversimplified reality quite a bit. It's fine to store ...unless we store (System architecture really isn't my strongest side, so perhaps I'm missing something obvious) |
I realize I probably don't understand the React architecture well enough to be in there. I've updated the PR, it uses Kind of unrelated, but related: My hope was to also move
It seems that I don't know what to make of this. :) |
We should use a different terminology in the internals for referring to these nodes so that we don't overload it's meaning with the proposed public ReactNode interface. My plan for ReactCompositeComponent was actually for it to reach out to the _parentNode to do it's replacement so that it could handle changes in fragments too. That would make it needed on all nodes. Jordan may have a different idea though. We should coordinate on this because there are so many overlapping requirements here. |
Yeah I kind of realized that too, leaving it for you guys (again :)), unless I can make myself useful somehow. PS. Closing because this is not really an "issue" and it will happen eventually anyway. |
@syranide I'll be in Stockholm and Örebro in September. We should have a hackathon. :) |
@sebmarkbage Haha, that would be awesome ;) |
@chenglou I'm pretty sure you want something like this for your event overhaul right? (to get rid of ID hacking)
After my short discussion with @sebmarkbage in #1922, I realized that I could implement a compromise of #1570. Where instead of removing
data-reactid
entirely, we can shorten it to justdata-react
(with no value) until the refactor is done and we have had a chance to evaluate and decide on the most preferable behavior.The advantage of the compromise is that it will be more isolated and will work identically to the current lazy implementation. So server-generated markup should be considerably smaller (compression will remove any
data-react
overhead), we also gain some of the performance benefit of the shorter markup.This is probably a hot topic, but I believe this is inevitable if we want to get rid of ID hacking and concatenated IDs (which I'm positive we do want to get rid of).