Skip to content

Commit 7652e40

Browse files
acdlitekoto
authored andcommitted
1 parent c203b86 commit 7652e40

7 files changed

+540
-492
lines changed

packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ beforeEach(() => {
1717

1818
// Don't feel too guilty if you have to delete this test.
1919
// @gate dfsEffectsRefactor
20-
// @gate new
2120
// @gate __DEV__
2221
test('warns in DEV if return pointer is inconsistent', async () => {
2322
const {useRef, useLayoutEffect} = React;

packages/react-reconciler/src/ReactChildFiber.old.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -282,22 +282,13 @@ function ChildReconciler(shouldTrackSideEffects) {
282282
childToDelete.nextEffect = null;
283283
childToDelete.flags = (childToDelete.flags & StaticMask) | Deletion;
284284

285-
let deletions = returnFiber.deletions;
285+
const deletions = returnFiber.deletions;
286286
if (deletions === null) {
287-
deletions = returnFiber.deletions = [childToDelete];
287+
returnFiber.deletions = [childToDelete];
288288
returnFiber.flags |= ChildDeletion;
289289
} else {
290290
deletions.push(childToDelete);
291291
}
292-
// Stash a reference to the return fiber's deletion array on each of the
293-
// deleted children. This is really weird, but it's a temporary workaround
294-
// while we're still using the effect list to traverse effect fibers. A
295-
// better workaround would be to follow the `.return` pointer in the commit
296-
// phase, but unfortunately we can't assume that `.return` points to the
297-
// correct fiber, even in the commit phase, because `findDOMNode` might
298-
// mutate it.
299-
// TODO: Remove this line.
300-
childToDelete.deletions = deletions;
301292
}
302293

303294
function deleteRemainingChildren(

packages/react-reconciler/src/ReactFiberBeginWork.old.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -2203,14 +2203,13 @@ function updateSuspensePrimaryChildren(
22032203
currentFallbackChildFragment.flags =
22042204
(currentFallbackChildFragment.flags & StaticMask) | Deletion;
22052205
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
2206-
let deletions = workInProgress.deletions;
2206+
const deletions = workInProgress.deletions;
22072207
if (deletions === null) {
2208-
deletions = workInProgress.deletions = [currentFallbackChildFragment];
2208+
workInProgress.deletions = [currentFallbackChildFragment];
22092209
workInProgress.flags |= ChildDeletion;
22102210
} else {
22112211
deletions.push(currentFallbackChildFragment);
22122212
}
2213-
currentFallbackChildFragment.deletions = deletions;
22142213
}
22152214

22162215
workInProgress.child = primaryChildFragment;
@@ -3194,14 +3193,13 @@ function remountFiber(
31943193
current.nextEffect = null;
31953194
current.flags = (current.flags & StaticMask) | Deletion;
31963195

3197-
let deletions = returnFiber.deletions;
3196+
const deletions = returnFiber.deletions;
31983197
if (deletions === null) {
3199-
deletions = returnFiber.deletions = [current];
3198+
returnFiber.deletions = [current];
32003199
returnFiber.flags |= ChildDeletion;
32013200
} else {
32023201
deletions.push(current);
32033202
}
3204-
current.deletions = deletions;
32053203

32063204
newWorkInProgress.flags |= Placement;
32073205

0 commit comments

Comments
 (0)