Skip to content

Commit 0412f0c

Browse files
authored
add offscreen state node (#24026)
Add state node on Offscreen fibers with id (in preparation for transition tracing)
1 parent d9677e3 commit 0412f0c

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import type {WorkTag} from './ReactWorkTags';
1515
import type {TypeOfMode} from './ReactTypeOfMode';
1616
import type {Lanes} from './ReactFiberLane.new';
1717
import type {SuspenseInstance, Props} from './ReactFiberHostConfig';
18-
import type {OffscreenProps} from './ReactFiberOffscreenComponent';
18+
import type {
19+
OffscreenProps,
20+
OffscreenInstance,
21+
} from './ReactFiberOffscreenComponent';
1922

2023
import {
2124
createRootStrictEffectsByDefault,
@@ -735,6 +738,8 @@ export function createFiberFromOffscreen(
735738
const fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
736739
fiber.elementType = REACT_OFFSCREEN_TYPE;
737740
fiber.lanes = lanes;
741+
const primaryChildInstance: OffscreenInstance = {};
742+
fiber.stateNode = primaryChildInstance;
738743
return fiber;
739744
}
740745

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import type {WorkTag} from './ReactWorkTags';
1515
import type {TypeOfMode} from './ReactTypeOfMode';
1616
import type {Lanes} from './ReactFiberLane.old';
1717
import type {SuspenseInstance, Props} from './ReactFiberHostConfig';
18-
import type {OffscreenProps} from './ReactFiberOffscreenComponent';
18+
import type {
19+
OffscreenProps,
20+
OffscreenInstance,
21+
} from './ReactFiberOffscreenComponent';
1922

2023
import {
2124
createRootStrictEffectsByDefault,
@@ -735,6 +738,8 @@ export function createFiberFromOffscreen(
735738
const fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
736739
fiber.elementType = REACT_OFFSCREEN_TYPE;
737740
fiber.lanes = lanes;
741+
const primaryChildInstance: OffscreenInstance = {};
742+
fiber.stateNode = primaryChildInstance;
738743
return fiber;
739744
}
740745

packages/react-reconciler/src/ReactFiberOffscreenComponent.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ export type OffscreenState = {|
3131
baseLanes: Lanes,
3232
cachePool: SpawnedCachePool | null,
3333
|};
34+
35+
export type OffscreenInstance = {};

0 commit comments

Comments
 (0)