use .bytes() but it is broken on errors

This commit is contained in:
Zack Radisic
2025-09-08 16:59:02 -07:00
parent 8b35b5634a
commit 2fad71dd45
2 changed files with 5 additions and 1 deletions

View File

@@ -159,6 +159,9 @@ export async function render(
// Buffer the entire response and return it all at once
const htmlStream = renderToHtml(rscPayload, meta.modules, signal);
const result = await htmlStream.bytes();
/*
const chunks: Uint8Array[] = [];
const reader = htmlStream.getReader();
@@ -194,6 +197,7 @@ export async function render(
result.set(chunk, offset);
offset += chunk.length;
}
*/
const opts = als?.getStore()?.responseOptions ?? { headers: {} };
const { headers, ...response_options } = opts;

View File

@@ -162,7 +162,7 @@ class RscInjectionStream extends EventEmitter {
const { resolve, promise, reject } = Promise.withResolvers<void>();
this.finished = promise;
this.finalize = resolve;
this.finalize = x => (controller.close(), resolve(x));
this.reject = reject;
rscPayload.on("data", this.writeRscData.bind(this));