Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make React integration work with Deno #4679

Merged
merged 3 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/orange-llamas-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/react': patch
---

Prevent decoder from leaking
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 11 additions & 4 deletions packages/integrations/react/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}
Expand Down