File tree Expand file tree Collapse file tree
packages/vike-react/src/integration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,10 +102,10 @@ function onUncaughtErrorGlobal(
102102}
103103type OnUncaughtError = RootOptions [ 'onUncaughtError' ]
104104type OnUncaughtErrorArgs = Parameters < NonNullable < RootOptions [ 'onUncaughtError' ] > >
105+ type OnUncaughtErrorInfo = OnUncaughtErrorArgs [ 1 ]
105106
106107// Inject componentStack to the error's stack trace
107108// - Server counterpart: https://github.com/brillout/react-streaming/blob/e0a6210957e65dad2c92877ad075ebac4713d8fa/src/server/renderToStream/common.ts#L93
108- type OnUncaughtErrorInfo = OnUncaughtErrorArgs [ 1 ]
109109function getErrorWithComponentStack ( errorOriginal : unknown , errorInfo ?: OnUncaughtErrorInfo ) {
110110 if ( ! errorInfo ?. componentStack || ! isObject ( errorOriginal ) ) return errorOriginal
111111 const errorStackLines = String ( errorOriginal . stack ) . split ( '\n' )
Original file line number Diff line number Diff line change @@ -86,16 +86,15 @@ async function renderPageToHtml(pageContext: PageContextServer) {
8686 // @ts -ignore
8787 pageContext . userAgent
8888 // Properties are set conditionally (instead of being assigned `undefined`) to satisfy `exactOptionalPropertyTypes`.
89- const renderOptions : RenderToStreamOptions = { }
89+ const options : RenderToStreamOptions = { }
9090 // When streamSetting.type is null: let react-streaming decide the stream type
91- if ( streamSetting . type ) renderOptions . webStream = streamSetting . type === 'web'
92- if ( userAgent ) renderOptions . userAgent = userAgent
91+ if ( streamSetting . type ) options . webStream = streamSetting . type === 'web'
92+ if ( userAgent ) options . userAgent = userAgent
9393 // +stream.require is true => default +stream.enable is true
9494 // +stream.require is false => default +stream.enable is false
9595 // Don't override disabling when a bot is detected.
96- if ( streamSetting . enable === false ) renderOptions . disable = true
97- Object . assign ( renderOptions , renderToStreamOptions )
98- const pageHtmlStream = await renderToStream ( pageContext . page , renderOptions )
96+ if ( streamSetting . enable === false ) options . disable = true
97+ const pageHtmlStream = await renderToStream ( pageContext . page , { ...options , ...renderToStreamOptions } )
9998 pageContext . pageHtmlStream = pageHtmlStream
10099 }
101100 }
You can’t perform that action at this time.
0 commit comments