mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Hide children of Offscreen after destroy effects (#24446)
This commit is contained in:
@@ -42,6 +42,7 @@ import {
|
||||
enableUpdaterTracking,
|
||||
enableCache,
|
||||
enableTransitionTracing,
|
||||
enableFlipOffscreenUnhideOrder,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import {
|
||||
FunctionComponent,
|
||||
@@ -2270,28 +2271,56 @@ function commitMutationEffectsOnFiber(
|
||||
const isHidden = newState !== null;
|
||||
const offscreenBoundary: Fiber = finishedWork;
|
||||
|
||||
if (supportsMutation) {
|
||||
// TODO: This needs to run whenever there's an insertion or update
|
||||
// inside a hidden Offscreen tree.
|
||||
hideOrUnhideAllChildren(offscreenBoundary, isHidden);
|
||||
}
|
||||
|
||||
if (enableSuspenseLayoutEffectSemantics) {
|
||||
if (isHidden) {
|
||||
if (!wasHidden) {
|
||||
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
||||
nextEffect = offscreenBoundary;
|
||||
let offscreenChild = offscreenBoundary.child;
|
||||
while (offscreenChild !== null) {
|
||||
nextEffect = offscreenChild;
|
||||
disappearLayoutEffects_begin(offscreenChild);
|
||||
offscreenChild = offscreenChild.sibling;
|
||||
if (enableFlipOffscreenUnhideOrder) {
|
||||
if (enableSuspenseLayoutEffectSemantics) {
|
||||
if (isHidden) {
|
||||
if (!wasHidden) {
|
||||
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
||||
nextEffect = offscreenBoundary;
|
||||
let offscreenChild = offscreenBoundary.child;
|
||||
while (offscreenChild !== null) {
|
||||
nextEffect = offscreenChild;
|
||||
disappearLayoutEffects_begin(offscreenChild);
|
||||
offscreenChild = offscreenChild.sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wasHidden) {
|
||||
// TODO: Move re-appear call here for symmetry?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wasHidden) {
|
||||
// TODO: Move re-appear call here for symmetry?
|
||||
}
|
||||
|
||||
if (supportsMutation) {
|
||||
// TODO: This needs to run whenever there's an insertion or update
|
||||
// inside a hidden Offscreen tree.
|
||||
hideOrUnhideAllChildren(offscreenBoundary, isHidden);
|
||||
}
|
||||
} else {
|
||||
if (supportsMutation) {
|
||||
// TODO: This needs to run whenever there's an insertion or update
|
||||
// inside a hidden Offscreen tree.
|
||||
hideOrUnhideAllChildren(offscreenBoundary, isHidden);
|
||||
}
|
||||
|
||||
if (enableSuspenseLayoutEffectSemantics) {
|
||||
if (isHidden) {
|
||||
if (!wasHidden) {
|
||||
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
||||
nextEffect = offscreenBoundary;
|
||||
let offscreenChild = offscreenBoundary.child;
|
||||
while (offscreenChild !== null) {
|
||||
nextEffect = offscreenChild;
|
||||
disappearLayoutEffects_begin(offscreenChild);
|
||||
offscreenChild = offscreenChild.sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wasHidden) {
|
||||
// TODO: Move re-appear call here for symmetry?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
enableUpdaterTracking,
|
||||
enableCache,
|
||||
enableTransitionTracing,
|
||||
enableFlipOffscreenUnhideOrder,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import {
|
||||
FunctionComponent,
|
||||
@@ -2270,28 +2271,56 @@ function commitMutationEffectsOnFiber(
|
||||
const isHidden = newState !== null;
|
||||
const offscreenBoundary: Fiber = finishedWork;
|
||||
|
||||
if (supportsMutation) {
|
||||
// TODO: This needs to run whenever there's an insertion or update
|
||||
// inside a hidden Offscreen tree.
|
||||
hideOrUnhideAllChildren(offscreenBoundary, isHidden);
|
||||
}
|
||||
|
||||
if (enableSuspenseLayoutEffectSemantics) {
|
||||
if (isHidden) {
|
||||
if (!wasHidden) {
|
||||
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
||||
nextEffect = offscreenBoundary;
|
||||
let offscreenChild = offscreenBoundary.child;
|
||||
while (offscreenChild !== null) {
|
||||
nextEffect = offscreenChild;
|
||||
disappearLayoutEffects_begin(offscreenChild);
|
||||
offscreenChild = offscreenChild.sibling;
|
||||
if (enableFlipOffscreenUnhideOrder) {
|
||||
if (enableSuspenseLayoutEffectSemantics) {
|
||||
if (isHidden) {
|
||||
if (!wasHidden) {
|
||||
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
||||
nextEffect = offscreenBoundary;
|
||||
let offscreenChild = offscreenBoundary.child;
|
||||
while (offscreenChild !== null) {
|
||||
nextEffect = offscreenChild;
|
||||
disappearLayoutEffects_begin(offscreenChild);
|
||||
offscreenChild = offscreenChild.sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wasHidden) {
|
||||
// TODO: Move re-appear call here for symmetry?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wasHidden) {
|
||||
// TODO: Move re-appear call here for symmetry?
|
||||
}
|
||||
|
||||
if (supportsMutation) {
|
||||
// TODO: This needs to run whenever there's an insertion or update
|
||||
// inside a hidden Offscreen tree.
|
||||
hideOrUnhideAllChildren(offscreenBoundary, isHidden);
|
||||
}
|
||||
} else {
|
||||
if (supportsMutation) {
|
||||
// TODO: This needs to run whenever there's an insertion or update
|
||||
// inside a hidden Offscreen tree.
|
||||
hideOrUnhideAllChildren(offscreenBoundary, isHidden);
|
||||
}
|
||||
|
||||
if (enableSuspenseLayoutEffectSemantics) {
|
||||
if (isHidden) {
|
||||
if (!wasHidden) {
|
||||
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
||||
nextEffect = offscreenBoundary;
|
||||
let offscreenChild = offscreenBoundary.child;
|
||||
while (offscreenChild !== null) {
|
||||
nextEffect = offscreenChild;
|
||||
disappearLayoutEffects_begin(offscreenChild);
|
||||
offscreenChild = offscreenChild.sibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (wasHidden) {
|
||||
// TODO: Move re-appear call here for symmetry?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export const skipUnmountedBoundaries = true;
|
||||
//
|
||||
// TODO: Finish rolling out in www
|
||||
export const enableSuspenseLayoutEffectSemantics = true;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
|
||||
// TODO: Finish rolling out in www
|
||||
export const enableClientRenderFallbackOnTextMismatch = true;
|
||||
|
||||
@@ -59,6 +59,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = false;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = true;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -49,6 +49,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = false;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = false;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -49,6 +49,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = false;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = false;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -44,6 +44,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = false;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = false;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -49,6 +49,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = false;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = false;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -49,6 +49,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = false;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = false;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -49,6 +49,7 @@ export const disableNativeComponentFrames = false;
|
||||
export const skipUnmountedBoundaries = true;
|
||||
export const deletedTreeCleanUpLevel = 3;
|
||||
export const enableSuspenseLayoutEffectSemantics = false;
|
||||
export const enableFlipOffscreenUnhideOrder = false;
|
||||
export const enableGetInspectorDataForInstanceInProduction = false;
|
||||
export const enableNewReconciler = false;
|
||||
export const deferRenderPhaseUpdateToNextBatch = false;
|
||||
|
||||
@@ -29,6 +29,7 @@ export const enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay = __
|
||||
export const enableClientRenderFallbackOnTextMismatch = __VARIANT__;
|
||||
export const enableTransitionTracing = __VARIANT__;
|
||||
export const enableSymbolFallbackForWWW = __VARIANT__;
|
||||
export const enableFlipOffscreenUnhideOrder = __VARIANT__;
|
||||
// Enable this flag to help with concurrent mode debugging.
|
||||
// It logs information to the console about React scheduling, rendering, and commit phases.
|
||||
//
|
||||
|
||||
@@ -33,6 +33,7 @@ export const {
|
||||
enableSyncDefaultUpdates,
|
||||
enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay,
|
||||
enableClientRenderFallbackOnTextMismatch,
|
||||
enableFlipOffscreenUnhideOrder,
|
||||
} = dynamicFeatureFlags;
|
||||
|
||||
// On WWW, __EXPERIMENTAL__ is used for a new modern build.
|
||||
|
||||
Reference in New Issue
Block a user