From 563d3771a5f5c1aaabd885e1a226864a9741e078 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 8 Apr 2020 13:40:27 +0100 Subject: [PATCH] Reset nextEffect points with the new passive effect feature flag too --- packages/react-reconciler/src/ReactFiberWorkLoop.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 24420f9ebebbf..715277d6b17c0 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -2273,6 +2273,8 @@ function flushPassiveEffectsImpl() { for (let i = 0; i < unmountEffects.length; i += 2) { const effect = ((unmountEffects[i]: any): HookEffect); const fiber = ((unmountEffects[i + 1]: any): Fiber); + // Remove nextEffect pointer to assist GC + fiber.nextEffect = null; const destroy = effect.destroy; effect.destroy = undefined; if (typeof destroy === 'function') { @@ -2324,6 +2326,8 @@ function flushPassiveEffectsImpl() { for (let i = 0; i < mountEffects.length; i += 2) { const effect = ((mountEffects[i]: any): HookEffect); const fiber = ((mountEffects[i + 1]: any): Fiber); + // Remove nextEffect pointer to assist GC + fiber.nextEffect = null; if (__DEV__) { setCurrentDebugFiberInDEV(fiber); if (