Skip to content

Use incrementing numerical IDs to identify DOM components - #5205

Merged
sophiebits merged 18 commits into
react:masterfrom
sophiebits:cotree-num
Nov 4, 2015
Merged

Use incrementing numerical IDs to identify DOM components#5205
sophiebits merged 18 commits into
react:masterfrom
sophiebits:cotree-num

Conversation

@sophiebits

Copy link
Copy Markdown
Contributor

Builds on #5190. So... ignore the first 10 commits.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@spicyj updated the pull request.

Initial render can still be a markup string.
New module! With this, we have a new module that uses the component tree to store DOM nodes. Most of the logic in this file relates to markup adoption -- if we were to drop that (along with server rendering) this file could just be a `return inst._nativeNode;`.

This works with useCreateElement only because we need to reference each node as it's created.

Events is now the only thing using ReactMount.getNode -- I'll introduce pointers back from the DOM nodes (and a `ReactDOMComponentTree.getInstanceFromNode`) and make that work.
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@spicyj updated the pull request.

@sebmarkbage

Copy link
Copy Markdown
Contributor

Good luck!

Next step: take advantage of having the native instances in EventPropagators instead of converting right back to IDs.
This removes SimpleEventPlugin's dependency on ReactMount.getID.
This test relied on the fact that ReactDOMComponent still produced hierarchical IDs -- although this module could be used standalone, we're replacing it completely so it makes more sense to just move the tests over to test ReactDOMTreeTraversal.
- Remove last references to ReactInstanceHandles (still used in responder unit test)
- Remove ClientReactRootIndex/ServerReactRootIndex
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@spicyj updated the pull request.

sophiebits added a commit that referenced this pull request Nov 4, 2015
Use incrementing numerical IDs to identify DOM components
@sophiebits
sophiebits merged commit 35962a0 into react:master Nov 4, 2015
@afraser

afraser commented Apr 8, 2016

Copy link
Copy Markdown

Is there any way that this could cause problems when using an older version of React on the same page?

@sophiebits

Copy link
Copy Markdown
Contributor Author

Good question. I think this should probably be fine alongside 0.14 but didn't test.

@afraser

afraser commented Apr 8, 2016

Copy link
Copy Markdown

I'm wondering about 0.13.3 in particular. If I don't get an answer here I'll let you all know what I find when I dive in.

mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Use incrementing numerical IDs to identify DOM components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants