| 4444 | } |
| 4445 | |
| 4446 | export function isPreambleReady( |
| 4447 | renderState: RenderState, |
| 4448 | // This means there are unfinished Suspense boundaries which could contain |
| 4449 | // a preamble. In the case of DOM we constrain valid programs to only having |
| 4450 | // one instance of each singleton so we can determine the preamble is ready |
| 4451 | // as long as we have chunks for each of these tags. |
| 4452 | hasPendingPreambles: boolean, |
| 4453 | ): boolean { |
| 4454 | const preamble = renderState.preamble; |
| 4455 | return ( |
| 4456 | // There are no remaining boundaries which might contain a preamble so |
| 4457 | // the preamble is as complete as it is going to get |
| 4458 | hasPendingPreambles === false || |
| 4459 | // we have a head and body tag. we don't need to wait for any more |
| 4460 | // because it would be invalid to render additional copies of these tags |
| 4461 | !!(preamble.headChunks && preamble.bodyChunks) |
| 4462 | ); |
| 4463 | } |
| 4464 | |
| 4465 | function writeBootstrap( |
| 4466 | destination: Destination, |