@@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
17
17
var React = require ( "next/dist/compiled/react-experimental" ) ;
18
18
var ReactDOM = require ( 'react-dom' ) ;
19
19
20
- var ReactVersion = '18.3.0-experimental-d803f519e-20231020 ' ;
20
+ var ReactVersion = '18.3.0-experimental-b8e47d988-20231023 ' ;
21
21
22
22
var ReactSharedInternals = React . __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED ;
23
23
@@ -1909,7 +1909,7 @@ function createResumableState(identifierPrefix, externalRuntimeConfig) {
1909
1909
moduleUnknownResources : { } ,
1910
1910
moduleScriptResources : { }
1911
1911
} ;
1912
- } // Constants for the insertion mode we're currently writing in. We don't encode all HTML5 insertion
1912
+ }
1913
1913
// modes. We only include the variants as they matter for the sake of our purposes.
1914
1914
// We don't actually provide the namespace therefore we use constants instead of the string.
1915
1915
@@ -3538,7 +3538,7 @@ function pushStyleImpl(target, props) {
3538
3538
}
3539
3539
3540
3540
pushInnerHTML ( target , innerHTML , children ) ;
3541
- target . push ( endTag1 , stringToChunk ( 'style' ) , endTag2 ) ;
3541
+ target . push ( endChunkForTag ( 'style' ) ) ;
3542
3542
return null ;
3543
3543
}
3544
3544
@@ -3760,7 +3760,7 @@ function pushTitleImpl(target, props) {
3760
3760
}
3761
3761
3762
3762
pushInnerHTML ( target , innerHTML , children ) ;
3763
- target . push ( endTag1 , stringToChunk ( 'title' ) , endTag2 ) ;
3763
+ target . push ( endChunkForTag ( 'title' ) ) ;
3764
3764
return null ;
3765
3765
}
3766
3766
@@ -3903,7 +3903,7 @@ function pushScriptImpl(target, props) {
3903
3903
target . push ( stringToChunk ( encodeHTMLTextNode ( children ) ) ) ;
3904
3904
}
3905
3905
3906
- target . push ( endTag1 , stringToChunk ( 'script' ) , endTag2 ) ;
3906
+ target . push ( endChunkForTag ( 'script' ) ) ;
3907
3907
return null ;
3908
3908
}
3909
3909
@@ -4241,8 +4241,19 @@ function pushStartInstance(target, type, props, resumableState, renderState, for
4241
4241
4242
4242
return pushStartGenericElement ( target , props , type ) ;
4243
4243
}
4244
- var endTag1 = stringToPrecomputedChunk ( '</' ) ;
4245
- var endTag2 = stringToPrecomputedChunk ( '>' ) ;
4244
+ var endTagCache = new Map ( ) ;
4245
+
4246
+ function endChunkForTag ( tag ) {
4247
+ var chunk = endTagCache . get ( tag ) ;
4248
+
4249
+ if ( chunk === undefined ) {
4250
+ chunk = stringToPrecomputedChunk ( '</' + tag + '>' ) ;
4251
+ endTagCache . set ( tag , chunk ) ;
4252
+ }
4253
+
4254
+ return chunk ;
4255
+ }
4256
+
4246
4257
function pushEndInstance ( target , type , props , resumableState , formatContext ) {
4247
4258
switch ( type ) {
4248
4259
// When float is on we expect title and script tags to always be pushed in
@@ -4299,7 +4310,7 @@ function pushEndInstance(target, type, props, resumableState, formatContext) {
4299
4310
break ;
4300
4311
}
4301
4312
4302
- target . push ( endTag1 , stringToChunk ( type ) , endTag2 ) ;
4313
+ target . push ( endChunkForTag ( type ) ) ;
4303
4314
}
4304
4315
4305
4316
function writeBootstrap ( destination , renderState ) {
@@ -5088,9 +5099,7 @@ function writePreamble(destination, resumableState, renderState, willFlushAllSeg
5088
5099
// if the main content contained the </head> it would also have provided a
5089
5100
// <head>. This means that all the content inside <html> is either <body> or
5090
5101
// invalid HTML
5091
- writeChunk ( destination , endTag1 ) ;
5092
- writeChunk ( destination , stringToChunk ( 'head' ) ) ;
5093
- writeChunk ( destination , endTag2 ) ;
5102
+ writeChunk ( destination , endChunkForTag ( 'head' ) ) ;
5094
5103
}
5095
5104
} // We don't bother reporting backpressure at the moment because we expect to
5096
5105
// flush the entire preamble in a single pass. This probably should be modified
@@ -5147,15 +5156,11 @@ function writeHoistables(destination, resumableState, renderState) {
5147
5156
}
5148
5157
function writePostamble ( destination , resumableState ) {
5149
5158
if ( resumableState . hasBody ) {
5150
- writeChunk ( destination , endTag1 ) ;
5151
- writeChunk ( destination , stringToChunk ( 'body' ) ) ;
5152
- writeChunk ( destination , endTag2 ) ;
5159
+ writeChunk ( destination , endChunkForTag ( 'body' ) ) ;
5153
5160
}
5154
5161
5155
5162
if ( resumableState . hasHtml ) {
5156
- writeChunk ( destination , endTag1 ) ;
5157
- writeChunk ( destination , stringToChunk ( 'html' ) ) ;
5158
- writeChunk ( destination , endTag2 ) ;
5163
+ writeChunk ( destination , endChunkForTag ( 'html' ) ) ;
5159
5164
}
5160
5165
}
5161
5166
var arrayFirstOpenBracket = stringToPrecomputedChunk ( '[' ) ;
@@ -9997,6 +10002,18 @@ function trackPostpone(request, trackedPostpones, task, segment) {
9997
10002
var keyPath = task . keyPath ;
9998
10003
var boundary = task . blockedBoundary ;
9999
10004
10005
+ if ( boundary === null ) {
10006
+ segment . id = request . nextSegmentId ++ ;
10007
+ trackedPostpones . rootSlots = segment . id ;
10008
+
10009
+ if ( request . completedRootSegment !== null ) {
10010
+ // Postpone the root if this was a deeper segment.
10011
+ request . completedRootSegment . status = POSTPONED ;
10012
+ }
10013
+
10014
+ return ;
10015
+ }
10016
+
10000
10017
if ( boundary !== null && boundary . status === PENDING ) {
10001
10018
boundary . status = POSTPONED ; // We need to eagerly assign it an ID because we'll need to refer to
10002
10019
// it before flushing and we know that we can't inline it.
@@ -10260,7 +10277,7 @@ function renderNode(request, task, node, childIndex) {
10260
10277
return ;
10261
10278
}
10262
10279
10263
- if ( request . trackedPostpones !== null && x . $$typeof === REACT_POSTPONE_TYPE && task . blockedBoundary !== null // TODO: Support holes in the shell
10280
+ if ( request . trackedPostpones !== null && x . $$typeof === REACT_POSTPONE_TYPE && task . blockedBoundary !== null // bubble if we're postponing in the shell
10264
10281
) {
10265
10282
// If we're tracking postpones, we inject a hole here and continue rendering
10266
10283
// sibling. Similar to suspending. If we're not tracking, we treat it more like
@@ -10731,20 +10748,19 @@ function retryRenderTask(request, task, segment) {
10731
10748
x . then ( ping , ping ) ;
10732
10749
task . thenableState = getThenableStateAfterSuspending ( ) ;
10733
10750
return ;
10734
- } else if ( request . trackedPostpones !== null && x . $$typeof === REACT_POSTPONE_TYPE && task . blockedBoundary !== null // TODO: Support holes in the shell
10735
- ) {
10736
- // If we're tracking postpones, we mark this segment as postponed and finish
10737
- // the task without filling it in. If we're not tracking, we treat it more like
10738
- // an error.
10739
- var trackedPostpones = request . trackedPostpones ;
10740
- task . abortSet . delete ( task ) ;
10741
- var postponeInstance = x ;
10742
- logPostpone ( request , postponeInstance . message ) ;
10743
- trackPostpone ( request , trackedPostpones , task , segment ) ;
10744
- finishedTask ( request , task . blockedBoundary , segment ) ;
10745
- lastBoundaryErrorComponentStackDev = null ;
10746
- return ;
10747
- }
10751
+ } else if ( request . trackedPostpones !== null && x . $$typeof === REACT_POSTPONE_TYPE ) {
10752
+ // If we're tracking postpones, we mark this segment as postponed and finish
10753
+ // the task without filling it in. If we're not tracking, we treat it more like
10754
+ // an error.
10755
+ var trackedPostpones = request . trackedPostpones ;
10756
+ task . abortSet . delete ( task ) ;
10757
+ var postponeInstance = x ;
10758
+ logPostpone ( request , postponeInstance . message ) ;
10759
+ trackPostpone ( request , trackedPostpones , task , segment ) ;
10760
+ finishedTask ( request , task . blockedBoundary , segment ) ;
10761
+ lastBoundaryErrorComponentStackDev = null ;
10762
+ return ;
10763
+ }
10748
10764
}
10749
10765
10750
10766
task . abortSet . delete ( task ) ;
@@ -11145,7 +11161,10 @@ function flushCompletedQueues(request, destination) {
11145
11161
var completedRootSegment = request . completedRootSegment ;
11146
11162
11147
11163
if ( completedRootSegment !== null ) {
11148
- if ( request . pendingRootTasks === 0 ) {
11164
+ if ( completedRootSegment . status === POSTPONED ) {
11165
+ // We postponed the root, so we write nothing.
11166
+ return ;
11167
+ } else if ( request . pendingRootTasks === 0 ) {
11149
11168
if ( enableFloat ) {
11150
11169
writePreamble ( destination , request . resumableState , request . renderState , request . allPendingTasks === 0 && request . trackedPostpones === null ) ;
11151
11170
}
0 commit comments