File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,14 @@ export default function injectRSCPayload(
103103 } ;
104104
105105 const writeHTMLChunks = ( ) => {
106+ if ( htmlBuffer . length === 0 ) {
107+ return ;
108+ }
109+
110+ if ( ! rscPromise ) {
111+ rscPromise = startRSC ( ) ;
112+ }
113+
106114 resultStream . push ( Buffer . concat ( htmlBuffer ) ) ;
107115 htmlBuffer . length = 0 ;
108116 } ;
@@ -114,9 +122,6 @@ export default function injectRSCPayload(
114122 }
115123
116124 timeout = setTimeout ( ( ) => {
117- if ( ! rscPromise ) {
118- rscPromise = startRSC ( ) ;
119- }
120125 writeHTMLChunks ( ) ;
121126 timeout = null ;
122127 } , 0 ) ;
@@ -130,10 +135,13 @@ export default function injectRSCPayload(
130135 if ( timeout ) {
131136 clearTimeout ( timeout ) ;
132137 }
138+ writeHTMLChunks ( ) ;
139+
133140 if ( ! rscPromise ) {
134- rscPromise = startRSC ( ) ;
141+ resultStream . end ( ) ;
142+ return ;
135143 }
136- writeHTMLChunks ( ) ;
144+
137145 rscPromise
138146 . then ( ( ) => {
139147 resultStream . end ( ) ;
You can’t perform that action at this time.
0 commit comments