From fd4b80bdeb3afda8f806b7141c6ed78ecad6141c Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 8 Sep 2022 10:46:16 -0400 Subject: [PATCH 1/3] Remove removed packages folder --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 99c018feeda9..5505eb0458fd 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "packages/*", "examples/*", "examples/component/demo", - "examples/component/packages/*", "scripts", "packages/astro/test/fixtures/component-library-shared", "packages/astro/test/fixtures/custom-elements/my-component-lib", From f6560bf1e8ebb09482dfec4ad61caf44c89f49a7 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 8 Sep 2022 11:51:10 -0400 Subject: [PATCH 2/3] fix --- packages/integrations/react/server.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js index 76e7f01e769e..3dd2a3cbc7db 100644 --- a/packages/integrations/react/server.js +++ b/packages/integrations/react/server.js @@ -144,10 +144,17 @@ async function readResult(stream) { let result = ''; const decoder = new TextDecoder('utf-8') while (true) { - const { done, value } = await reader.read(); - if (done) { - return result; - } + const { done, value } = await reader.read(); + if (done) { + if(value) { + result += decoder.decode(value); + } else { + // This closes the decoder + decoder.decode(new Uint8Array()); + } + + return result; + } result += decoder.decode(value, { stream: true }); } } From 4ea7afcd4c82137b95d9e0a8cae5497d6d3b46f4 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 8 Sep 2022 11:53:18 -0400 Subject: [PATCH 3/3] Add a changeset --- .changeset/orange-llamas-play.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/orange-llamas-play.md diff --git a/.changeset/orange-llamas-play.md b/.changeset/orange-llamas-play.md new file mode 100644 index 000000000000..04c0e5ae403b --- /dev/null +++ b/.changeset/orange-llamas-play.md @@ -0,0 +1,5 @@ +--- +'@astrojs/react': patch +--- + +Prevent decoder from leaking