Skip to content

Commit 98882dd

Browse files
committed
Restrict types of keyPath when it is known
When we render an element, we provide the newly created keypath because that means we're never at the root.
1 parent 09285d5 commit 98882dd

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

packages/react-server/src/ReactFizzServer.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ function fatalError(request: Request, error: mixed): void {
789789
function renderSuspenseBoundary(
790790
request: Request,
791791
someTask: Task,
792-
keyPath: Root | KeyNode,
792+
keyPath: KeyNode,
793793
props: Object,
794794
): void {
795795
if (someTask.replay !== null) {
@@ -960,7 +960,7 @@ function renderSuspenseBoundary(
960960
function replaySuspenseBoundary(
961961
request: Request,
962962
task: ReplayTask,
963-
keyPath: Root | KeyNode,
963+
keyPath: KeyNode,
964964
props: Object,
965965
id: number,
966966
childNodes: Array<ReplayNode>,
@@ -1064,7 +1064,7 @@ function replaySuspenseBoundary(
10641064
function renderBackupSuspenseBoundary(
10651065
request: Request,
10661066
task: Task,
1067-
keyPath: Root | KeyNode,
1067+
keyPath: KeyNode,
10681068
props: Object,
10691069
) {
10701070
pushBuiltInComponentStackInDEV(task, 'Suspense');
@@ -1090,7 +1090,7 @@ function renderBackupSuspenseBoundary(
10901090
function renderHostElement(
10911091
request: Request,
10921092
task: Task,
1093-
keyPath: Root | KeyNode,
1093+
keyPath: KeyNode,
10941094
type: string,
10951095
props: Object,
10961096
): void {
@@ -1156,7 +1156,7 @@ function shouldConstruct(Component: any) {
11561156
function renderWithHooks<Props, SecondArg>(
11571157
request: Request,
11581158
task: Task,
1159-
keyPath: Root | KeyNode,
1159+
keyPath: KeyNode,
11601160
prevThenableState: ThenableState | null,
11611161
Component: (p: Props, arg: SecondArg) => any,
11621162
props: Props,
@@ -1177,7 +1177,7 @@ function renderWithHooks<Props, SecondArg>(
11771177
function finishClassComponent(
11781178
request: Request,
11791179
task: Task,
1180-
keyPath: Root | KeyNode,
1180+
keyPath: KeyNode,
11811181
instance: any,
11821182
Component: any,
11831183
props: any,
@@ -1223,7 +1223,7 @@ function finishClassComponent(
12231223
function renderClassComponent(
12241224
request: Request,
12251225
task: Task,
1226-
keyPath: Root | KeyNode,
1226+
keyPath: KeyNode,
12271227
Component: any,
12281228
props: any,
12291229
): void {
@@ -1252,7 +1252,7 @@ let hasWarnedAboutUsingContextAsConsumer = false;
12521252
function renderIndeterminateComponent(
12531253
request: Request,
12541254
task: Task,
1255-
keyPath: Root | KeyNode,
1255+
keyPath: KeyNode,
12561256
prevThenableState: ThenableState | null,
12571257
Component: any,
12581258
props: any,
@@ -1379,7 +1379,7 @@ function renderIndeterminateComponent(
13791379
function finishFunctionComponent(
13801380
request: Request,
13811381
task: Task,
1382-
keyPath: Root | KeyNode,
1382+
keyPath: KeyNode,
13831383
children: ReactNodeList,
13841384
hasId: boolean,
13851385
formStateCount: number,
@@ -1506,7 +1506,7 @@ function resolveDefaultProps(Component: any, baseProps: Object): Object {
15061506
function renderForwardRef(
15071507
request: Request,
15081508
task: Task,
1509-
keyPath: Root | KeyNode,
1509+
keyPath: KeyNode,
15101510
prevThenableState: null | ThenableState,
15111511
type: any,
15121512
props: Object,
@@ -1540,7 +1540,7 @@ function renderForwardRef(
15401540
function renderMemo(
15411541
request: Request,
15421542
task: Task,
1543-
keyPath: Root | KeyNode,
1543+
keyPath: KeyNode,
15441544
prevThenableState: ThenableState | null,
15451545
type: any,
15461546
props: Object,
@@ -1562,7 +1562,7 @@ function renderMemo(
15621562
function renderContextConsumer(
15631563
request: Request,
15641564
task: Task,
1565-
keyPath: Root | KeyNode,
1565+
keyPath: KeyNode,
15661566
context: ReactContext<any>,
15671567
props: Object,
15681568
): void {
@@ -1616,7 +1616,7 @@ function renderContextConsumer(
16161616
function renderContextProvider(
16171617
request: Request,
16181618
task: Task,
1619-
keyPath: Root | KeyNode,
1619+
keyPath: KeyNode,
16201620
type: ReactProviderType<any>,
16211621
props: Object,
16221622
): void {
@@ -1645,7 +1645,7 @@ function renderContextProvider(
16451645
function renderLazyComponent(
16461646
request: Request,
16471647
task: Task,
1648-
keyPath: Root | KeyNode,
1648+
keyPath: KeyNode,
16491649
prevThenableState: ThenableState | null,
16501650
lazyComponent: LazyComponentType<any, any>,
16511651
props: Object,
@@ -1671,7 +1671,7 @@ function renderLazyComponent(
16711671
function renderOffscreen(
16721672
request: Request,
16731673
task: Task,
1674-
keyPath: Root | KeyNode,
1674+
keyPath: KeyNode,
16751675
props: Object,
16761676
): void {
16771677
const mode: ?OffscreenMode = (props.mode: any);
@@ -1691,7 +1691,7 @@ function renderOffscreen(
16911691
function renderElement(
16921692
request: Request,
16931693
task: Task,
1694-
keyPath: Root | KeyNode,
1694+
keyPath: KeyNode,
16951695
prevThenableState: ThenableState | null,
16961696
type: any,
16971697
props: Object,
@@ -1882,7 +1882,7 @@ function resumeNode(
18821882
function resumeElement(
18831883
request: Request,
18841884
task: ReplayTask,
1885-
keyPath: Root | KeyNode,
1885+
keyPath: KeyNode,
18861886
segmentId: number,
18871887
prevThenableState: ThenableState | null,
18881888
type: any,
@@ -1926,7 +1926,7 @@ function resumeElement(
19261926
function replayElement(
19271927
request: Request,
19281928
task: ReplayTask,
1929-
keyPath: Root | KeyNode,
1929+
keyPath: KeyNode,
19301930
prevThenableState: ThenableState | null,
19311931
name: null | string,
19321932
keyOrIndex: number | string,

0 commit comments

Comments
 (0)