dillon1000/react

Commit

findDOMNode: Remove return pointer mutation (#20272)

The last step of the `findDOMNode` algorithm is a search of the
current tree.

When descending into a child node, it mutates `child.return` so that it
points to the current fiber pair, instead of a work-in-progress. This
can cause bugs if `findDOMNode` is called at the wrong time, like in
an interleaved event.

For this reason (among others), you're not suppposed to use
`findDOMNode` in Concurrent Mode. However, we still have some internal
uses that we haven't migrated.

To reduce the potential for bugs, I've removed the `.return` pointer
assignment in favor of recursion.
Browse files
Changed paths1 file
First-parent comparison
M packages/react-reconciler/src/ReactFiberTreeReflection.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…