Skip to content

Commit

Permalink
add offscreen state node
Browse files Browse the repository at this point in the history
  • Loading branch information
lunaruan committed Mar 3, 2022
1 parent cb1e7b1 commit 914a54f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {SuspenseContext} from './ReactFiberSuspenseContext.new';
import type {
OffscreenProps,
OffscreenState,
OffscreenInstance,
} from './ReactFiberOffscreenComponent';
import type {
Cache,
Expand Down Expand Up @@ -2278,11 +2279,13 @@ function mountSuspensePrimaryChildren(
mode: 'visible',
children: primaryChildren,
};
const primaryChildInstance: OffscreenInstance = {};
const primaryChildFragment = mountWorkInProgressOffscreenFiber(
primaryChildProps,
mode,
renderLanes,
);
primaryChildFragment.stateNode = primaryChildInstance;
primaryChildFragment.return = workInProgress;
workInProgress.child = primaryChildFragment;
return primaryChildFragment;
Expand All @@ -2301,6 +2304,7 @@ function mountSuspenseFallbackChildren(
mode: 'hidden',
children: primaryChildren,
};
const primaryChildInstance: OffscreenInstance = {};

let primaryChildFragment;
let fallbackChildFragment;
Expand Down Expand Up @@ -2345,6 +2349,7 @@ function mountSuspenseFallbackChildren(
);
}

primaryChildFragment.stateNode = primaryChildInstance;
primaryChildFragment.return = workInProgress;
fallbackChildFragment.return = workInProgress;
primaryChildFragment.sibling = fallbackChildFragment;
Expand Down
2 changes: 2 additions & 0 deletions packages/react-reconciler/src/ReactFiberOffscreenComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ export type OffscreenState = {|
baseLanes: Lanes,
cachePool: SpawnedCachePool | null,
|};

export type OffscreenInstance = {};

0 comments on commit 914a54f

Please sign in to comment.