@@ -13,7 +13,7 @@ import type {LazyComponent} from 'react/src/ReactLazy';
13
13
import type {
14
14
ClientReference ,
15
15
ClientReferenceMetadata ,
16
- UninitializedModel ,
16
+ UninitializedValue ,
17
17
Response ,
18
18
SSRManifest ,
19
19
} from './ReactFlightClientHostConfig' ;
@@ -22,7 +22,7 @@ import {
22
22
resolveClientReference ,
23
23
preloadModule ,
24
24
requireModule ,
25
- parseModel ,
25
+ parseValue ,
26
26
} from './ReactFlightClientHostConfig' ;
27
27
28
28
import { REACT_LAZY_TYPE , REACT_ELEMENT_TYPE } from 'shared/ReactSymbols' ;
@@ -41,7 +41,7 @@ export type JSONValue =
41
41
42
42
const PENDING = 'pending';
43
43
const BLOCKED = 'blocked';
44
- const RESOLVED_MODEL = 'resolved_model ';
44
+ const RESOLVED_VALUE = 'resolved_value ';
45
45
const RESOLVED_MODULE = 'resolved_module';
46
46
const INITIALIZED = 'fulfilled';
47
47
const ERRORED = 'rejected';
@@ -60,9 +60,9 @@ type BlockedChunk<T> = {
60
60
_response : Response ,
61
61
then ( resolve : ( T ) = > mixed , reject : ( mixed ) = > mixed ) : void ,
62
62
} ;
63
- type ResolvedModelChunk < T > = {
64
- status : 'resolved_model ' ,
65
- value : UninitializedModel ,
63
+ type ResolvedValueChunk < T > = {
64
+ status : 'resolved_value ' ,
65
+ value : UninitializedValue ,
66
66
reason : null ,
67
67
_response : Response ,
68
68
then ( resolve : ( T ) = > mixed , reject : ( mixed ) = > mixed ) : void ,
@@ -91,7 +91,7 @@ type ErroredChunk<T> = {
91
91
type SomeChunk< T > =
92
92
| PendingChunk< T >
93
93
| BlockedChunk< T >
94
- | ResolvedModelChunk < T >
94
+ | ResolvedValueChunk < T >
95
95
| ResolvedModuleChunk< T >
96
96
| InitializedChunk< T >
97
97
| ErroredChunk< T > ;
@@ -115,8 +115,8 @@ Chunk.prototype.then = function <T>(
115
115
// If we have resolved content, we try to initialize it first which
116
116
// might put us back into one of the other states.
117
117
switch ( chunk . status ) {
118
- case RESOLVED_MODEL :
119
- initializeModelChunk ( chunk ) ;
118
+ case RESOLVED_VALUE :
119
+ initializeValueChunk ( chunk ) ;
120
120
break ;
121
121
case RESOLVED_MODULE :
122
122
initializeModuleChunk ( chunk ) ;
@@ -161,8 +161,8 @@ function readChunk<T>(chunk: SomeChunk<T>): T {
161
161
// If we have resolved content, we try to initialize it first which
162
162
// might put us back into one of the other states.
163
163
switch ( chunk . status ) {
164
- case RESOLVED_MODEL :
165
- initializeModelChunk ( chunk ) ;
164
+ case RESOLVED_VALUE :
165
+ initializeValueChunk ( chunk ) ;
166
166
break ;
167
167
case RESOLVED_MODULE :
168
168
initializeModuleChunk ( chunk ) ;
@@ -247,12 +247,12 @@ function triggerErrorOnChunk<T>(chunk: SomeChunk<T>, error: mixed): void {
247
247
}
248
248
}
249
249
250
- function createResolvedModelChunk < T > (
250
+ function createResolvedValueChunk < T > (
251
251
response: Response,
252
- value: UninitializedModel ,
253
- ): ResolvedModelChunk < T > {
252
+ value: UninitializedValue ,
253
+ ): ResolvedValueChunk < T > {
254
254
// $FlowFixMe Flow doesn't support functions as constructors
255
- return new Chunk ( RESOLVED_MODEL , value , null , response ) ;
255
+ return new Chunk ( RESOLVED_VALUE , value , null , response ) ;
256
256
}
257
257
258
258
function createResolvedModuleChunk< T > (
@@ -263,24 +263,24 @@ function createResolvedModuleChunk<T>(
263
263
return new Chunk ( RESOLVED_MODULE , value , null , response ) ;
264
264
}
265
265
266
- function resolveModelChunk < T > (
266
+ function resolveValueChunk < T > (
267
267
chunk: SomeChunk< T > ,
268
- value: UninitializedModel ,
268
+ value: UninitializedValue ,
269
269
): void {
270
270
if ( chunk . status !== PENDING ) {
271
271
// We already resolved. We didn't expect to see this.
272
272
return ;
273
273
}
274
274
const resolveListeners = chunk.value;
275
275
const rejectListeners = chunk.reason;
276
- const resolvedChunk: ResolvedModelChunk < T > = (chunk: any);
277
- resolvedChunk.status = RESOLVED_MODEL ;
276
+ const resolvedChunk: ResolvedValueChunk < T > = (chunk: any);
277
+ resolvedChunk.status = RESOLVED_VALUE ;
278
278
resolvedChunk.value = value;
279
279
if (resolveListeners !== null) {
280
280
// This is unfortunate that we're reading this eagerly if
281
281
// we already have listeners attached since they might no
282
282
// longer be rendered or might not be the highest pri.
283
- initializeModelChunk ( resolvedChunk ) ;
283
+ initializeValueChunk ( resolvedChunk ) ;
284
284
// The status might have changed after initialization.
285
285
wakeChunkIfInitialized ( chunk , resolveListeners , rejectListeners ) ;
286
286
}
@@ -305,20 +305,20 @@ function resolveModuleChunk<T>(
305
305
}
306
306
}
307
307
308
- let initializingChunk : ResolvedModelChunk < any > = (null: any);
309
- let initializingChunkBlockedModel : null | { deps : number , value : any } = null;
310
- function initializeModelChunk < T > (chunk: ResolvedModelChunk < T > ): void {
308
+ let initializingChunk : ResolvedValueChunk < any > = (null: any);
309
+ let initializingChunkBlockedValue : null | { deps : number , value : any } = null;
310
+ function initializeValueChunk < T > (chunk: ResolvedValueChunk < T > ): void {
311
311
const prevChunk = initializingChunk ;
312
- const prevBlocked = initializingChunkBlockedModel ;
312
+ const prevBlocked = initializingChunkBlockedValue ;
313
313
initializingChunk = chunk ;
314
- initializingChunkBlockedModel = null ;
314
+ initializingChunkBlockedValue = null ;
315
315
try {
316
- const value : T = parseModel ( chunk . _response , chunk . value ) ;
316
+ const value : T = parseValue ( chunk . _response , chunk . value ) ;
317
317
if (
318
- initializingChunkBlockedModel !== null &&
319
- initializingChunkBlockedModel . deps > 0
318
+ initializingChunkBlockedValue !== null &&
319
+ initializingChunkBlockedValue . deps > 0
320
320
) {
321
- initializingChunkBlockedModel . value = value ;
321
+ initializingChunkBlockedValue . value = value ;
322
322
// We discovered new dependencies on modules that are not yet resolved.
323
323
// We have to go the BLOCKED state until they're resolved.
324
324
const blockedChunk : BlockedChunk < T > = ( chunk : any ) ;
@@ -336,7 +336,7 @@ function initializeModelChunk<T>(chunk: ResolvedModelChunk<T>): void {
336
336
erroredChunk . reason = error ;
337
337
} finally {
338
338
initializingChunk = prevChunk ;
339
- initializingChunkBlockedModel = prevBlocked ;
339
+ initializingChunkBlockedValue = prevBlocked ;
340
340
}
341
341
}
342
342
@@ -434,17 +434,17 @@ function getChunk(response: Response, id: number): SomeChunk<any> {
434
434
return chunk ;
435
435
}
436
436
437
- function createModelResolver < T > (
437
+ function createValueResolver < T > (
438
438
chunk: SomeChunk< T > ,
439
439
parentObject: Object,
440
440
key: string,
441
441
): (value: any) => void {
442
442
let blocked ;
443
- if ( initializingChunkBlockedModel ) {
444
- blocked = initializingChunkBlockedModel ;
443
+ if ( initializingChunkBlockedValue ) {
444
+ blocked = initializingChunkBlockedValue ;
445
445
blocked . deps ++ ;
446
446
} else {
447
- blocked = initializingChunkBlockedModel = {
447
+ blocked = initializingChunkBlockedValue = {
448
448
deps : 1 ,
449
449
value : null ,
450
450
} ;
@@ -467,7 +467,7 @@ function createModelResolver<T>(
467
467
} ;
468
468
}
469
469
470
- function createModelReject < T > (chunk: SomeChunk< T > ): (error: mixed) => void {
470
+ function createValueReject < T > (chunk: SomeChunk< T > ): (error: mixed) => void {
471
471
return ( error : mixed ) = > triggerErrorOnChunk ( chunk , error ) ;
472
472
}
473
473
@@ -498,7 +498,7 @@ function createServerReferenceProxy<A: Iterable<any>, T>(
498
498
return proxy;
499
499
}
500
500
501
- export function parseModelString (
501
+ export function parseValueString (
502
502
response: Response,
503
503
parentObject: Object,
504
504
key: string,
@@ -541,8 +541,8 @@ export function parseModelString(
541
541
const id = parseInt ( value . substring ( 2 ) , 16 ) ;
542
542
const chunk = getChunk ( response , id ) ;
543
543
switch ( chunk . status ) {
544
- case RESOLVED_MODEL :
545
- initializeModelChunk ( chunk ) ;
544
+ case RESOLVED_VALUE :
545
+ initializeValueChunk ( chunk ) ;
546
546
break ;
547
547
}
548
548
// The status might have changed after initialization.
@@ -561,8 +561,8 @@ export function parseModelString(
561
561
const id = parseInt ( value . substring ( 1 ) , 16 ) ;
562
562
const chunk = getChunk ( response , id ) ;
563
563
switch ( chunk . status ) {
564
- case RESOLVED_MODEL :
565
- initializeModelChunk ( chunk ) ;
564
+ case RESOLVED_VALUE :
565
+ initializeValueChunk ( chunk ) ;
566
566
break ;
567
567
case RESOLVED_MODULE :
568
568
initializeModuleChunk ( chunk ) ;
@@ -576,8 +576,8 @@ export function parseModelString(
576
576
case BLOCKED :
577
577
const parentChunk = initializingChunk ;
578
578
chunk . then (
579
- createModelResolver ( parentChunk , parentObject , key ) ,
580
- createModelReject ( parentChunk ) ,
579
+ createValueResolver ( parentChunk , parentObject , key ) ,
580
+ createValueReject ( parentChunk ) ,
581
581
) ;
582
582
return null ;
583
583
default :
@@ -589,7 +589,7 @@ export function parseModelString(
589
589
return value ;
590
590
}
591
591
592
- export function parseModelTuple (
592
+ export function parseValueTuple (
593
593
response : Response ,
594
594
value : { + [ key : string ] : JSONValue } | $ReadOnlyArray < JSONValue > ,
595
595
) : any {
@@ -626,27 +626,27 @@ export function createResponse(
626
626
export function resolveModel (
627
627
response : Response ,
628
628
id : number ,
629
- model : UninitializedModel ,
629
+ value : UninitializedValue ,
630
630
) : void {
631
631
const chunks = response . _chunks ;
632
632
const chunk = chunks . get ( id ) ;
633
633
if ( ! chunk ) {
634
- chunks . set ( id , createResolvedModelChunk ( response , model ) ) ;
634
+ chunks . set ( id , createResolvedValueChunk ( response , value ) ) ;
635
635
} else {
636
- resolveModelChunk ( chunk , model ) ;
636
+ resolveValueChunk ( chunk , value ) ;
637
637
}
638
638
}
639
639
640
640
export function resolveModule (
641
641
response : Response ,
642
642
id : number ,
643
- model : UninitializedModel ,
643
+ value : UninitializedValue ,
644
644
) : void {
645
645
const chunks = response . _chunks ;
646
646
const chunk = chunks . get ( id ) ;
647
- const clientReferenceMetadata : ClientReferenceMetadata = parseModel (
647
+ const clientReferenceMetadata : ClientReferenceMetadata = parseValue (
648
648
response ,
649
- model ,
649
+ value ,
650
650
) ;
651
651
const clientReference = resolveClientReference < $FlowFixMe > (
652
652
response . _ssrManifest ,
0 commit comments