mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add early exit to strict mode (#25235)
This commit is contained in:
@@ -3172,6 +3172,11 @@ function recursivelyTraverseAndDoubleInvokeEffectsInDEV(
|
||||
parentFiber: Fiber,
|
||||
isInStrictMode: boolean,
|
||||
) {
|
||||
if ((parentFiber.subtreeFlags & (PlacementDEV | Visibility)) === NoFlags) {
|
||||
// Parent's descendants have already had effects double invoked.
|
||||
// Early exit to avoid unnecessary tree traversal.
|
||||
return;
|
||||
}
|
||||
let child = parentFiber.child;
|
||||
while (child !== null) {
|
||||
doubleInvokeEffectsInDEV(root, child, isInStrictMode);
|
||||
|
||||
@@ -3172,6 +3172,11 @@ function recursivelyTraverseAndDoubleInvokeEffectsInDEV(
|
||||
parentFiber: Fiber,
|
||||
isInStrictMode: boolean,
|
||||
) {
|
||||
if ((parentFiber.subtreeFlags & (PlacementDEV | Visibility)) === NoFlags) {
|
||||
// Parent's descendants have already had effects double invoked.
|
||||
// Early exit to avoid unnecessary tree traversal.
|
||||
return;
|
||||
}
|
||||
let child = parentFiber.child;
|
||||
while (child !== null) {
|
||||
doubleInvokeEffectsInDEV(root, child, isInStrictMode);
|
||||
|
||||
Reference in New Issue
Block a user