From 69b0ae7f094e2c9915022858bf3a565ac08c3581 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 13 Jun 2022 17:53:50 -0700 Subject: [PATCH 1/2] add transitions to stack when Offscreen is visible --- .../react-reconciler/src/ReactFiberBeginWork.new.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.new.js b/packages/react-reconciler/src/ReactFiberBeginWork.new.js index 0688ae8a04f..c8c1f3cbb05 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.new.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.new.js @@ -779,7 +779,17 @@ function updateOffscreenComponent( prevCachePool = prevState.cachePool; } - pushTransition(workInProgress, prevCachePool, null); + let transitions = null; + if ( + workInProgress.memoizedState !== null && + workInProgress.memoizedState.transitions !== null + ) { + // We have now gone from hidden to visible, so any transitions should + // be added to the stack to get added to any Offscreen/suspense children + transitions = workInProgress.memoizedState.transitions; + } + + pushTransition(workInProgress, prevCachePool, transitions); // Since we're not hidden anymore, reset the state workInProgress.memoizedState = null; From 7da489b8ed0ea580c46988c1d240da670b8a5194 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 13 Jun 2022 17:54:47 -0700 Subject: [PATCH 2/2] old --- .../react-reconciler/src/ReactFiberBeginWork.old.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.old.js b/packages/react-reconciler/src/ReactFiberBeginWork.old.js index 74595fda434..8f98c76b3b1 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.old.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.old.js @@ -779,7 +779,17 @@ function updateOffscreenComponent( prevCachePool = prevState.cachePool; } - pushTransition(workInProgress, prevCachePool, null); + let transitions = null; + if ( + workInProgress.memoizedState !== null && + workInProgress.memoizedState.transitions !== null + ) { + // We have now gone from hidden to visible, so any transitions should + // be added to the stack to get added to any Offscreen/suspense children + transitions = workInProgress.memoizedState.transitions; + } + + pushTransition(workInProgress, prevCachePool, transitions); // Since we're not hidden anymore, reset the state workInProgress.memoizedState = null;