@@ -201,14 +201,6 @@ function createErrorChunk<T>(
201201 return new Chunk ( ERRORED , null , error , response ) ;
202202}
203203
204- function createInitializedChunk< T > (
205- response: Response,
206- value: T,
207- ): InitializedChunk< T > {
208- // $FlowFixMe Flow doesn't support functions as constructors
209- return new Chunk ( INITIALIZED , value , null , response ) ;
210- }
211-
212204function wakeChunk< T > (listeners: Array< ( T ) => mixed > , value: T): void {
213205 for ( let i = 0 ; i < listeners . length ; i ++ ) {
214206 const listener = listeners [ i ] ;
@@ -483,14 +475,32 @@ export function parseModelString(
483475 key: string,
484476 value: string,
485477): any {
486- switch ( value [ 0 ] ) {
487- case '$' : {
488- if ( value === '$' ) {
489- return REACT_ELEMENT_TYPE ;
490- } else if ( value [ 1 ] === '$' || value [ 1 ] === '@' ) {
478+ if ( value [ 0 ] === '$' ) {
479+ if ( value === '$' ) {
480+ // A very common symbol.
481+ return REACT_ELEMENT_TYPE ;
482+ }
483+ switch (value[1]) {
484+ case '$' : {
491485 // This was an escaped string value.
492486 return value . substring ( 1 ) ;
493- } else {
487+ }
488+ case 'L' : {
489+ // Lazy node
490+ const id = parseInt ( value . substring ( 2 ) , 16 ) ;
491+ const chunk = getChunk ( response , id ) ;
492+ // We create a React.lazy wrapper around any lazy values.
493+ // When passed into React, we'll know how to suspend on this.
494+ return createLazyChunkWrapper ( chunk ) ;
495+ }
496+ case 'S' : {
497+ return Symbol . for ( value . substring ( 2 ) ) ;
498+ }
499+ case 'P' : {
500+ return getOrCreateServerContext ( value . substring ( 2 ) ) . Provider ;
501+ }
502+ default : {
503+ // We assume that anything else is a reference ID.
494504 const id = parseInt ( value . substring ( 1 ) , 16 ) ;
495505 const chunk = getChunk ( response , id ) ;
496506 switch ( chunk . status ) {
@@ -518,13 +528,6 @@ export function parseModelString(
518528 }
519529 }
520530 }
521- case '@': {
522- const id = parseInt ( value . substring ( 1 ) , 16 ) ;
523- const chunk = getChunk ( response , id ) ;
524- // We create a React.lazy wrapper around any lazy values.
525- // When passed into React, we'll know how to suspend on this.
526- return createLazyChunkWrapper ( chunk ) ;
527- }
528531 }
529532 return value ;
530533}
@@ -566,21 +569,6 @@ export function resolveModel(
566569 }
567570}
568571
569- export function resolveProvider (
570- response : Response ,
571- id : number ,
572- contextName : string ,
573- ) : void {
574- const chunks = response . _chunks ;
575- chunks . set (
576- id ,
577- createInitializedChunk (
578- response ,
579- getOrCreateServerContext ( contextName ) . Provider ,
580- ) ,
581- ) ;
582- }
583-
584572export function resolveModule (
585573 response : Response ,
586574 id : number ,
@@ -626,17 +614,6 @@ export function resolveModule(
626614 }
627615}
628616
629- export function resolveSymbol (
630- response : Response ,
631- id : number ,
632- name : string ,
633- ) : void {
634- const chunks = response . _chunks ;
635- // We assume that we'll always emit the symbol before anything references it
636- // to save a few bytes.
637- chunks . set ( id , createInitializedChunk ( response , Symbol . for ( name ) ) ) ;
638- }
639-
640617type ErrorWithDigest = Error & { digest ?: string } ;
641618export function resolveErrorProd (
642619 response : Response ,
0 commit comments