Skip to content

Commit

Permalink
Rename variable + strongly type stateNode
Browse files Browse the repository at this point in the history
  • Loading branch information
sammy-SC committed Dec 5, 2022
1 parent 469eaf7 commit 3eb1803
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ function updateOffscreenComponent(
) {
const nextProps: OffscreenProps = workInProgress.pendingProps;
const nextChildren = nextProps.children;
const isPendingDetached =
const nextIsDetached =
(workInProgress.stateNode._pendingVisibility & OffscreenDetached) !== 0;

const prevState: OffscreenState | null =
Expand All @@ -697,7 +697,7 @@ function updateOffscreenComponent(
nextProps.mode === 'hidden' ||
(enableLegacyHidden &&
nextProps.mode === 'unstable-defer-without-hiding') ||
isPendingDetached
nextIsDetached
) {
// Rendering a hidden tree.

Expand Down
13 changes: 7 additions & 6 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -2876,18 +2876,19 @@ function commitMutationEffectsOnFiber(
}

commitReconciliationEffects(finishedWork);

const offscreenInstance: OffscreenInstance = finishedWork.stateNode;

// TODO: Add explicit effect flag to set _current.
finishedWork.stateNode._current = finishedWork;
offscreenInstance._current = finishedWork;

// Offscreen stores pending changes to visibility in `_pendingVisibility`. This is
// to support batching of `attach` and `detach` calls.
finishedWork.stateNode._visibility &= ~OffscreenDetached;
finishedWork.stateNode._visibility |=
finishedWork.stateNode._pendingVisibility & OffscreenDetached;
offscreenInstance._visibility &= ~OffscreenDetached;
offscreenInstance._visibility |=
offscreenInstance._pendingVisibility & OffscreenDetached;

if (flags & Visibility) {
const offscreenInstance: OffscreenInstance = finishedWork.stateNode;

// Track the current state on the Offscreen instance so we can
// read it during an event
if (isHidden) {
Expand Down

0 comments on commit 3eb1803

Please sign in to comment.