Hot reloading: Avoid stack overflow on wide trees (#34145)

Every sibling added to the stack here. Not sure this needs to be
recursive at all but certainly for siblings this can just be a loop.
This commit is contained in:
Sophie Alpert 2025-08-09 08:02:22 -07:00 committed by GitHub
parent 3958d5d84b
commit cf6e502ed2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -261,6 +261,7 @@ function scheduleFibersWithFamiliesRecursively(
staleFamilies: Set<Family>,
): void {
if (__DEV__) {
do {
const {alternate, child, sibling, tag, type} = fiber;
let candidateType = null;
@ -323,12 +324,11 @@ function scheduleFibersWithFamiliesRecursively(
staleFamilies,
);
}
if (sibling !== null) {
scheduleFibersWithFamiliesRecursively(
sibling,
updatedFamilies,
staleFamilies,
);
}
if (sibling === null) {
break;
}
fiber = sibling;
} while (true);
}
}