@@ -374,6 +374,11 @@ function encodeHTMLTextNode(text: string): string {
374374 return escapeTextForBrowser ( text ) ;
375375}
376376
377+ // This const is returned when a push is fully consumed as a Resource. The runtime
378+ // well compare it against the returned children and avoid pushing the end tag
379+ opaque type ResourceSentinel = mixed ;
380+ export const RESOURCE_SENTINAL : ResourceSentinel = { } ;
381+
377382const textSeparator = stringToPrecomputedChunk ( '<!-- -->' ) ;
378383
379384export function pushTextInstance (
@@ -1155,7 +1160,7 @@ function pushMeta(
11551160 props : Object ,
11561161 responseState : ResponseState ,
11571162 textEmbedded : boolean ,
1158- ) : ReactNodeList {
1163+ ) : ReactNodeList | ResourceSentinel {
11591164 if ( enableFloat && resourcesFromElement ( 'meta' , props ) ) {
11601165 if ( textEmbedded ) {
11611166 // This link follows text but we aren't writing a tag. while not as efficient as possible we need
@@ -1164,7 +1169,7 @@ function pushMeta(
11641169 }
11651170 // We have converted this link exclusively to a resource and no longer
11661171 // need to emit it
1167- return null ;
1172+ return RESOURCE_SENTINAL ;
11681173 }
11691174
11701175 return pushSelfClosing ( target , props , 'meta' , responseState ) ;
@@ -1175,7 +1180,7 @@ function pushLink(
11751180 props : Object ,
11761181 responseState : ResponseState ,
11771182 textEmbedded : boolean ,
1178- ) : ReactNodeList {
1183+ ) : ReactNodeList | ResourceSentinel {
11791184 if ( enableFloat && resourcesFromLink ( props ) ) {
11801185 if ( textEmbedded ) {
11811186 // This link follows text but we aren't writing a tag. while not as efficient as possible we need
@@ -1184,7 +1189,7 @@ function pushLink(
11841189 }
11851190 // We have converted this link exclusively to a resource and no longer
11861191 // need to emit it
1187- return null ;
1192+ return RESOURCE_SENTINAL ;
11881193 }
11891194
11901195 return pushLinkImpl ( target , props , responseState ) ;
@@ -1298,11 +1303,11 @@ function pushStartTitle(
12981303 target : Array < Chunk | PrecomputedChunk > ,
12991304 props : Object ,
13001305 responseState : ResponseState ,
1301- ) : ReactNodeList {
1306+ ) : ReactNodeList | ResourceSentinel {
13021307 if ( enableFloat && resourcesFromElement ( 'title' , props ) ) {
13031308 // We have converted this link exclusively to a resource and no longer
13041309 // need to emit it
1305- return null ;
1310+ return RESOURCE_SENTINAL ;
13061311 }
13071312
13081313 return pushStartTitleImpl ( target , props , responseState ) ;
@@ -1415,7 +1420,7 @@ function pushStartScript(
14151420 props : Object ,
14161421 responseState : ResponseState ,
14171422 textEmbedded : boolean ,
1418- ) : ReactNodeList {
1423+ ) : ReactNodeList | ResourceSentinel {
14191424 if ( enableFloat && resourcesFromScript ( props ) ) {
14201425 if ( textEmbedded ) {
14211426 // This link follows text but we aren't writing a tag. while not as efficient as possible we need
@@ -1424,7 +1429,7 @@ function pushStartScript(
14241429 }
14251430 // We have converted this link exclusively to a resource and no longer
14261431 // need to emit it
1427- return null ;
1432+ return RESOURCE_SENTINAL ;
14281433 }
14291434
14301435 return pushStartGenericElement ( target , props , 'script' , responseState ) ;
@@ -1652,7 +1657,7 @@ export function pushStartInstance(
16521657 responseState : ResponseState ,
16531658 formatContext : FormatContext ,
16541659 textEmbedded : boolean ,
1655- ) : ReactNodeList {
1660+ ) : ReactNodeList | ResourceSentinel {
16561661 if ( __DEV__ ) {
16571662 validateARIAProperties ( type , props ) ;
16581663 validateInputProperties ( type , props ) ;
@@ -1767,6 +1772,10 @@ export function pushStartInstance(
17671772 }
17681773}
17691774
1775+ // function pushEndTitle(target: Array<Chunk | PrecomputedChunk>): void {
1776+ // if (enableFloat)
1777+ // }
1778+
17701779const endTag1 = stringToPrecomputedChunk ( '</' ) ;
17711780const endTag2 = stringToPrecomputedChunk ( '>' ) ;
17721781
0 commit comments