mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
clean up nextEffect pointers (#16115)
This commit is contained in:
committed by
Sebastian Markbåge
parent
997154bcc7
commit
b4178af81b
+14
-1
@@ -1712,6 +1712,16 @@ function commitRootImpl(root) {
|
||||
rootDoesHavePassiveEffects = false;
|
||||
rootWithPendingPassiveEffects = root;
|
||||
pendingPassiveEffectsExpirationTime = expirationTime;
|
||||
} else {
|
||||
// We are done with the effect chain at this point so let's clear the
|
||||
// nextEffect pointers to assist with GC. If we have passive effects, we'll
|
||||
// clear this in flushPassiveEffects.
|
||||
nextEffect = firstEffect;
|
||||
while (nextEffect !== null) {
|
||||
const nextNextEffect = nextEffect.nextEffect;
|
||||
nextEffect.nextEffect = null;
|
||||
nextEffect = nextNextEffect;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there's remaining work on this root
|
||||
@@ -1947,7 +1957,10 @@ export function flushPassiveEffects() {
|
||||
captureCommitPhaseError(effect, error);
|
||||
}
|
||||
}
|
||||
effect = effect.nextEffect;
|
||||
const nextNextEffect = effect.nextEffect;
|
||||
// Remove nextEffect pointer to assist GC
|
||||
effect.nextEffect = null;
|
||||
effect = nextNextEffect;
|
||||
}
|
||||
|
||||
if (enableSchedulerTracing) {
|
||||
|
||||
Reference in New Issue
Block a user