Don't skip content in visible offscreen trees for View Transitions (#35063)

Also, don't not skip hidden trees.

Memoized state is null when an Offscreen boundary (Suspense or Activity)
is visible.

This logic was inversed in a couple of View Transition checks which
caused pairs to be discovered or not discovered incorrectly for
insertion and deletion of Suspense or Activity boundaries.
This commit is contained in:
Sebastian Markbåge
2025-11-06 16:03:02 -05:00
committed by GitHub
parent 1a31a814f1
commit 37b089a59c

View File

@@ -233,7 +233,7 @@ function commitAppearingPairViewTransitions(placement: Fiber): void {
}
let child = placement.child;
while (child !== null) {
if (child.tag === OffscreenComponent && child.memoizedState === null) {
if (child.tag === OffscreenComponent && child.memoizedState !== null) {
// This tree was already hidden so we skip it.
} else {
commitAppearingPairViewTransitions(child);
@@ -347,7 +347,7 @@ function commitDeletedPairViewTransitions(deletion: Fiber): void {
}
let child = deletion.child;
while (child !== null) {
if (child.tag === OffscreenComponent && child.memoizedState === null) {
if (child.tag === OffscreenComponent && child.memoizedState !== null) {
// This tree was already hidden so we skip it.
} else {
if (
@@ -550,7 +550,7 @@ function restorePairedViewTransitions(parent: Fiber): void {
}
let child = parent.child;
while (child !== null) {
if (child.tag === OffscreenComponent && child.memoizedState === null) {
if (child.tag === OffscreenComponent && child.memoizedState !== null) {
// This tree was already hidden so we skip it.
} else {
if (