Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help debugging: https://github.com/facebook/react/pull/18542 #18543

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/react-reconciler/src/ReactFiberWorkLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ let pendingPassiveHookEffectsMount: Array<HookEffect | Fiber> = [];
let pendingPassiveHookEffectsUnmount: Array<HookEffect | Fiber> = [];
let pendingPassiveProfilerEffects: Array<Fiber> = [];

let testFibers = [];

let rootsWithPendingDiscreteUpdates: Map<
FiberRoot,
ExpirationTime,
Expand Down Expand Up @@ -1972,6 +1974,13 @@ function commitRootImpl(root, renderPriorityLevel) {
nextEffect.nextEffect = null;
nextEffect = nextNextEffect;
}
for (let i = 0; i < testFibers.length; i++) {
if (testFibers[i].nextEffect !== null) {
// Leave this in to test it
debugger;
}
}
testFibers = [];
}

// Check if there's remaining work on this root
Expand Down Expand Up @@ -2137,6 +2146,7 @@ function commitMutationEffects(root: FiberRoot, renderPriorityLevel) {
}
case Deletion: {
commitDeletion(root, nextEffect, renderPriorityLevel);
testFibers.push(nextEffect);
break;
}
}
Expand Down Expand Up @@ -2273,6 +2283,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') {
Expand Down Expand Up @@ -2324,6 +2336,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 (
Expand Down