From 9898088c0a976da2cbf7607d92e5daf5db6a4536 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 30 Sep 2022 19:25:22 -0400 Subject: [PATCH] =?UTF-8?q?Convert=20HTMLString=20to=20regular=20string,?= =?UTF-8?q?=20preventing=20hydration=20script=20fro=E2=80=A6=20(#4932)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Convert HTMLString to regular string, preventing hydration script from being missing * Add a changeset --- .changeset/khaki-tables-remember.md | 5 +++++ packages/astro/src/runtime/server/render/common.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/khaki-tables-remember.md diff --git a/.changeset/khaki-tables-remember.md b/.changeset/khaki-tables-remember.md new file mode 100644 index 000000000..5ce7873d9 --- /dev/null +++ b/.changeset/khaki-tables-remember.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Prevent hydration mismatch in streaming SSR diff --git a/packages/astro/src/runtime/server/render/common.ts b/packages/astro/src/runtime/server/render/common.ts index b8a998a4a..9274210f5 100644 --- a/packages/astro/src/runtime/server/render/common.ts +++ b/packages/astro/src/runtime/server/render/common.ts @@ -69,7 +69,7 @@ export class HTMLParts { } toArrayBuffer() { this.parts.forEach((part, i) => { - if (typeof part === 'string') { + if(!ArrayBuffer.isView(part)) { this.parts[i] = encoder.encode(String(part)); } });