mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix that
This commit is contained in:
@@ -3,6 +3,7 @@ packages/bun-usockets/src/crypto/sni_tree.cpp
|
||||
src/bake/BakeGlobalObject.cpp
|
||||
src/bake/BakeProduction.cpp
|
||||
src/bake/BakeSourceProvider.cpp
|
||||
src/bake/DevServerSourceProvider.cpp
|
||||
src/bun.js/bindings/ActiveDOMCallback.cpp
|
||||
src/bun.js/bindings/AsymmetricKeyValue.cpp
|
||||
src/bun.js/bindings/AsyncContextFrame.cpp
|
||||
|
||||
@@ -86,11 +86,13 @@ export async function render(request: Request, meta: Bake.RouteMetadata): Promis
|
||||
const signal: MiniAbortSignal = { aborted: false, abort: null! };
|
||||
({ pipe, abort: signal.abort } = renderToPipeableStream(page, serverManifest, {
|
||||
onError: err => {
|
||||
// console.error("onError renderToPipeableStream", !!signal.aborted);
|
||||
if (signal.aborted) return;
|
||||
|
||||
// Mark as aborted and call the abort function
|
||||
signal.aborted = true;
|
||||
signal.abort();
|
||||
signal.aborted = err;
|
||||
signal.abort(err);
|
||||
rscPayload.destroy(err);
|
||||
// For PassThrough streams, we need to properly close them
|
||||
// when an error occurs during React rendering
|
||||
// process.nextTick(() => {
|
||||
@@ -106,8 +108,9 @@ export async function render(request: Request, meta: Bake.RouteMetadata): Promis
|
||||
pipe(rscPayload);
|
||||
|
||||
rscPayload.on("error", err => {
|
||||
// console.error("rscPayload.on('error')", !!signal.aborted);
|
||||
if (signal.aborted) return;
|
||||
console.error(err);
|
||||
// console.error(err);
|
||||
});
|
||||
|
||||
if (skipSSR) {
|
||||
|
||||
@@ -58,8 +58,8 @@ export function renderToHtml(
|
||||
|
||||
// If the signal is already aborted, we should not proceed
|
||||
if (signal.aborted) {
|
||||
controller.close();
|
||||
return Promise.resolve();
|
||||
controller.close(signal.aborted);
|
||||
return Promise.reject(signal.aborted);
|
||||
}
|
||||
|
||||
// `renderToPipeableStream` is what actually generates HTML.
|
||||
@@ -69,7 +69,7 @@ export function renderToHtml(
|
||||
bootstrapModules,
|
||||
onError(error) {
|
||||
if (!signal.aborted) {
|
||||
console.error(error);
|
||||
// console.error(error);
|
||||
// Abort the rendering and close the stream
|
||||
signal.aborted = true;
|
||||
abort();
|
||||
@@ -87,8 +87,8 @@ export function renderToHtml(
|
||||
// Promise resolved after all data is combined.
|
||||
return stream.finished;
|
||||
},
|
||||
cancel() {
|
||||
signal.aborted = true;
|
||||
cancel(err) {
|
||||
// console.error("renderToHtml.cancel");
|
||||
signal.abort();
|
||||
abort?.();
|
||||
},
|
||||
@@ -306,7 +306,7 @@ class StaticRscInjectionStream extends EventEmitter {
|
||||
}
|
||||
|
||||
destroy(error) {
|
||||
console.error(error);
|
||||
// console.error(error);
|
||||
this.reject(error);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user