From bee95e7dc2b68505e26a6c5da1833f61cf8ce88e Mon Sep 17 00:00:00 2001 From: codehz Date: Mon, 10 Jun 2024 12:50:46 +0800 Subject: [PATCH] add noStreaming option --- index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.tsx b/index.tsx index 33c5893..0298af6 100644 --- a/index.tsx +++ b/index.tsx @@ -45,12 +45,14 @@ export class StaticRouters { if (error instanceof ClientOnlyError) return; console.error(error, errorInfo); }, + noStreaming, }: { Shell: React.ComponentType<{ children: React.ReactElement }>; preloadScript?: string; bootstrapModules?: string[]; context?: T; onError?(error: unknown, errorInfo: React.ErrorInfo): string | void; + noStreaming?: boolean; } ): Promise { const { pathname, search } = new URL(request.url); @@ -108,6 +110,9 @@ export class StaticRouters { onError, } ); + if (noStreaming) { + await stream.allReady; + } return new Response(stream, { headers: { "Content-Type": "text/html; charset=utf-8",