-
Notifications
You must be signed in to change notification settings - Fork 49.8k
[ServerContext] Flight support for ServerContext #23244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f75b5d3
29e80db
54e8812
e148a0a
532dfa2
f2868c2
a861492
fb521be
a7051aa
066b206
7706ed7
8bb4359
03f08ba
9948c43
0bb2d55
0dc363f
637ad8b
be811ec
3c8ec09
9c7e061
6f71944
d74b7bd
4d9d014
de7f685
079691e
cb66687
0946c5d
64c6477
1f5e888
8323eb8
640c4a8
c83c3cc
64621f0
905d184
42ca798
4457295
a69065b
ef20b40
c5a58d3
6124a34
fd1465e
ebe8a1e
4e8a2d2
72dbc55
6e4ed97
c5988f2
5397db6
9d30d7b
50594a2
43a71b2
69a9ccd
bc03997
499f20b
b5e5e47
90f6f08
672712e
03fb89b
db992af
9ceb955
d0d8f5d
eafb265
5b937ad
06b6008
c83bc66
534d370
8283b4b
c596825
04293a0
4b780b5
dc4081d
ff6269f
f5a8b25
a714680
81f798f
72ed1cc
4b808b1
463047c
3d16208
1c4eaf9
af300fc
9333935
2d5129c
573d394
26c5667
83fcb8b
278499d
b6bbe30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,13 @@ import { | |
| parseModel, | ||
| } from './ReactFlightClientHostConfig'; | ||
|
|
||
| import {REACT_LAZY_TYPE, REACT_ELEMENT_TYPE} from 'shared/ReactSymbols'; | ||
| import {getOrCreateServerContext} from 'react/src/ReactServerContext'; | ||
|
|
||
| import { | ||
| REACT_LAZY_TYPE, | ||
| REACT_ELEMENT_TYPE, | ||
| REACT_PROVIDER_TYPE, | ||
| } from 'shared/ReactSymbols'; | ||
|
|
||
| export type JSONValue = | ||
| | number | ||
|
|
@@ -318,6 +324,11 @@ export function parseModelString( | |
| // When passed into React, we'll know how to suspend on this. | ||
| return createLazyChunkWrapper(chunk); | ||
| } | ||
| case '!': { | ||
| if (value === '!') { | ||
| return REACT_PROVIDER_TYPE; | ||
| } | ||
| } | ||
| } | ||
| return value; | ||
| } | ||
|
|
@@ -327,10 +338,18 @@ export function parseModelTuple( | |
| value: {+[key: string]: JSONValue} | $ReadOnlyArray<JSONValue>, | ||
| ): any { | ||
| const tuple: [mixed, mixed, mixed, mixed] = (value: any); | ||
| if (tuple[0] === REACT_ELEMENT_TYPE) { | ||
| // TODO: Consider having React just directly accept these arrays as elements. | ||
| // Or even change the ReactElement type to be an array. | ||
| return createElement(tuple[1], tuple[2], tuple[3]); | ||
|
|
||
| switch (tuple[0]) { | ||
|
||
| case REACT_ELEMENT_TYPE: | ||
| // TODO: Consider having React just directly accept these arrays as elements. | ||
| // Or even change the ReactElement type to be an array. | ||
| return createElement(tuple[1], tuple[2], tuple[3]); | ||
| case REACT_PROVIDER_TYPE: | ||
|
||
| return createElement( | ||
| getOrCreateServerContext((tuple[1]: any)).Provider, | ||
| tuple[2], | ||
| tuple[3], | ||
| ); | ||
| } | ||
| return value; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.