diff --git a/src/lib/chunked.js b/src/lib/chunked.js index b5ec6c69..cbdffb3f 100644 --- a/src/lib/chunked.js +++ b/src/lib/chunked.js @@ -1,7 +1,7 @@ -import { renderToString } from '../index.js'; -import { CHILD_DID_SUSPEND, COMPONENT, PARENT } from './constants.js'; -import { Deferred } from './util.js'; -import { createInitScript, createSubtree } from './client.js'; +import { renderToString } from "../index.js"; +import { CHILD_DID_SUSPEND, COMPONENT, PARENT } from "./constants.js"; +import { Deferred } from "./util.js"; +import { createInitScript, createSubtree } from "./client.js"; /** * @param {VNode} vnode @@ -17,7 +17,7 @@ export async function renderToChunks(vnode, { context, onWrite, abortSignal }) { abortSignal, onWrite, onError: handleError, - suspended: [] + suspended: [], }; // Synchronously render the shell @@ -32,16 +32,14 @@ export async function renderToChunks(vnode, { context, onWrite, abortSignal }) { // and causes browsers to reject the content. Instead, we inject the deferred // content before the closing tags, then emit them last. const docSuffixIndex = getDocumentClosingTagsIndex(shell); - const hasHtmlTag = shell.trimStart().startsWith('' : ''; + const prefix = hasHtmlTag ? "" : ""; onWrite(prefix + initialWrite); - onWrite('