Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 418364d

Browse files
committedApr 8, 2020
Add clear fiber code
1 parent 78ab69a commit 418364d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,8 @@ function flushPassiveEffectsImpl() {
22832283
for (let i = 0; i < unmountEffects.length; i += 2) {
22842284
const effect = ((unmountEffects[i]: any): HookEffect);
22852285
const fiber = ((unmountEffects[i + 1]: any): Fiber);
2286+
// Remove nextEffect pointer to assist GC
2287+
fiber.nextEffect = null;
22862288
const destroy = effect.destroy;
22872289
effect.destroy = undefined;
22882290
if (typeof destroy === 'function') {
@@ -2334,6 +2336,8 @@ function flushPassiveEffectsImpl() {
23342336
for (let i = 0; i < mountEffects.length; i += 2) {
23352337
const effect = ((mountEffects[i]: any): HookEffect);
23362338
const fiber = ((mountEffects[i + 1]: any): Fiber);
2339+
// Remove nextEffect pointer to assist GC
2340+
fiber.nextEffect = null;
23372341
if (__DEV__) {
23382342
setCurrentDebugFiberInDEV(fiber);
23392343
if (

0 commit comments

Comments
 (0)
Please sign in to comment.