Remove null sibling (#18687)
Dominic Gannaway committed
Apr 21, 2020 at 10:43 UTC
80d39d8b5733d4ab22033aaf8b805de723e28fd1
2 files changed
+6
-2
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+3
-1
@@ -1116,6 +1116,9 @@ function detachFiber(fiber: Fiber) {
1116
// get GC:ed but we don't know which for sure which parent is the current
1117
// one so we'll settle for GC:ing the subtree of this child. This child
1118
// itself will be GC:ed when the parent updates the next time.
1119
+ // Note: we cannot null out sibling here, otherwise it can cause issues
1120
+ // with findDOMNode and how it requires the sibling field to carry out
1121
+ // traversal in a later effect. See PR #16820.
1122
fiber.alternate = null;
1123
fiber.child = null;
1124
fiber.dependencies = null;
@@ -1125,7 +1128,6 @@ function detachFiber(fiber: Fiber) {
1128
fiber.memoizedState = null;
1129
fiber.pendingProps = null;
1130
fiber.return = null;
1128
- fiber.sibling = null;
1131
fiber.stateNode = null;
1132
fiber.updateQueue = null;
1133
if (__DEV__) {
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+3
-1
@@ -1116,6 +1116,9 @@ function detachFiber(fiber: Fiber) {
1116
// get GC:ed but we don't know which for sure which parent is the current
1117
// one so we'll settle for GC:ing the subtree of this child. This child
1118
// itself will be GC:ed when the parent updates the next time.
1119
+ // Note: we cannot null out sibling here, otherwise it can cause issues
1120
+ // with findDOMNode and how it requires the sibling field to carry out
1121
+ // traversal in a later effect. See PR #16820.
1122
fiber.alternate = null;
1123
fiber.child = null;
1124
fiber.dependencies = null;
@@ -1125,7 +1128,6 @@ function detachFiber(fiber: Fiber) {
1128
fiber.memoizedState = null;
1129
fiber.pendingProps = null;
1130
fiber.return = null;
1128
- fiber.sibling = null;
1131
fiber.stateNode = null;
1132
fiber.updateQueue = null;
1133
if (__DEV__) {