Skip to content

Commit 30f1466

Browse files
committed
Add comment and make the condition more obvious
1 parent 838a7af commit 30f1466

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/react-reconciler/src/ReactFiberCommitWork.new.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,8 @@ function commitMutationEffectsOnFiber(
28802880
}
28812881

28822882
if (isHidden) {
2883-
if (current !== null && current.memoizedState === null) {
2883+
// Check if this is an update, and the tree was previously visible.
2884+
if (current !== null && !wasHidden) {
28842885
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
28852886
// Disappear the layout effects of all the children
28862887
recursivelyTraverseDisappearLayoutEffects(offscreenBoundary);

packages/react-reconciler/src/ReactFiberCommitWork.old.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,8 @@ function commitMutationEffectsOnFiber(
28802880
}
28812881

28822882
if (isHidden) {
2883-
if (current !== null && current.memoizedState === null) {
2883+
// Check if this is an update, and the tree was previously visible.
2884+
if (current !== null && !wasHidden) {
28842885
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
28852886
// Disappear the layout effects of all the children
28862887
recursivelyTraverseDisappearLayoutEffects(offscreenBoundary);

0 commit comments

Comments
 (0)