From e09e255ac725fd59195aa0f3918065d4bd974e6b Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Tue, 24 Oct 2023 22:22:20 -0700 Subject: [PATCH] add `noScripts` option for renderToStringAsync --- packages/dom-expressions/src/server.d.ts | 1 + packages/dom-expressions/src/server.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/dom-expressions/src/server.d.ts b/packages/dom-expressions/src/server.d.ts index 8fd9db25..6fd79e27 100644 --- a/packages/dom-expressions/src/server.d.ts +++ b/packages/dom-expressions/src/server.d.ts @@ -14,6 +14,7 @@ export function renderToStringAsync( nonce?: string; renderId?: string; event?: RequestEvent; + noScripts?: boolean; onError?: (err: any) => void; } ): Promise; diff --git a/packages/dom-expressions/src/server.js b/packages/dom-expressions/src/server.js index dd24d4da..fa024563 100644 --- a/packages/dom-expressions/src/server.js +++ b/packages/dom-expressions/src/server.js @@ -57,10 +57,11 @@ export function renderToStringAsync(code, options = {}) { } export function renderToStream(code, options = {}) { - let { nonce, onCompleteShell, onCompleteAll, renderId } = options; + let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options; let dispose; const blockingPromises = []; const pushTask = task => { + if (noScripts) return; // TODO is the correct place to put this if (!tasks && !firstFlushed) { tasks = getLocalHeaderScript(renderId);