File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
packages/react-reconciler/src Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -685,24 +685,18 @@ function updateOffscreenComponent(
685
685
) {
686
686
const nextProps : OffscreenProps = workInProgress . pendingProps ;
687
687
const nextChildren = nextProps . children ;
688
+ const isPendingDetached = ( workInProgress . stateNode . _pendingVisibility & OffscreenDetached ) !== 0 ;
688
689
689
690
const prevState : OffscreenState | null =
690
691
current !== null ? current . memoizedState : null ;
691
692
692
- // Offscreen stores pending changes to visibility in `_pendingVisibility`. This is
693
- // to support batching of `attach` and `detach` calls.
694
- workInProgress . stateNode . _visibility &= ~ OffscreenDetached ;
695
- workInProgress . stateNode . _visibility |=
696
- workInProgress . stateNode . _pendingVisibility & OffscreenDetached ;
697
-
698
693
markRef ( current , workInProgress ) ;
699
694
700
695
if (
701
696
nextProps . mode === 'hidden' ||
702
697
( enableLegacyHidden &&
703
698
nextProps . mode === 'unstable-defer-without-hiding' ) ||
704
- // TODO: remove read from stateNode.
705
- workInProgress . stateNode . _visibility & OffscreenDetached
699
+ isPendingDetached
706
700
) {
707
701
// Rendering a hidden tree.
708
702
Original file line number Diff line number Diff line change @@ -2879,6 +2879,12 @@ function commitMutationEffectsOnFiber(
2879
2879
// TODO: Add explicit effect flag to set _current.
2880
2880
finishedWork .stateNode . _current = finishedWork ;
2881
2881
2882
+ // Offscreen stores pending changes to visibility in `_pendingVisibility`. This is
2883
+ // to support batching of `attach` and `detach` calls.
2884
+ finishedWork . stateNode . _visibility &= ~ OffscreenDetached ;
2885
+ finishedWork . stateNode . _visibility |=
2886
+ finishedWork . stateNode . _pendingVisibility & OffscreenDetached ;
2887
+
2882
2888
if ( flags & Visibility ) {
2883
2889
const offscreenInstance : OffscreenInstance = finishedWork . stateNode ;
2884
2890
You can’t perform that action at this time.
0 commit comments