Skip to content
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
2 changes: 1 addition & 1 deletion examples/full/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@vitejs/plugin-react": "^5.1.1",
"react": "^19.2.1",
"react-dom": "^19.2.1",
"react-streaming": "^0.4.15",
"react-streaming": "^0.4.16",
"typescript": "^5.9.3",
"vike": "^0.4.253",
"vike-react": "0.6.20",
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-react-apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"react": "^19.2.1",
"react-dom": "^19.2.1",
"@types/react-dom": "^19.1.9",
"react-streaming": "^0.4.15",
"react-streaming": "^0.4.16",
"rimraf": "^5.0.5",
"typescript": "^5.9.2",
"vike": "^0.4.253",
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"jsdom": "^24.0.0",
"react": "^19.2.1",
"react-dom": "^19.2.1",
"react-streaming": "^0.4.15",
"react-streaming": "^0.4.16",
"rimraf": "^5.0.5",
"typescript": "^5.9.2",
"vike": "^0.4.253",
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-react-zustand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"typescript": "^5.9.2",
"vike": "^0.4.253",
"vike-react": "0.6.20",
"react-streaming": "^0.4.15",
"react-streaming": "^0.4.16",
"vite": "^7.3.0",
"zustand": "^5.0.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"./__internal/integration/Loading": "./dist/integration/Loading.js"
},
"dependencies": {
"react-streaming": "^0.4.15"
"react-streaming": "^0.4.16"
},
"peerDependencies": {
"react": ">=19",
Expand Down
3 changes: 2 additions & 1 deletion packages/vike-react/src/integration/onRenderHtml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function renderPageToHtml(pageContext: PageContextServer) {
// https://github.com/vikejs/vike-react/issues/87#issuecomment-2488742744
await callCumulativeHooks(pageContext.config.onBeforeRenderHtml, pageContext)

const { renderToStringOptions } = resolveReactOptions(pageContext)
const { renderToStringOptions, renderToStreamOptions } = resolveReactOptions(pageContext)

if (pageContext.page) {
const streamSetting = resolveStreamSetting(pageContext)
Expand Down Expand Up @@ -101,6 +101,7 @@ async function renderPageToHtml(pageContext: PageContextServer) {
false,
*/
undefined,
...renderToStreamOptions,
})
pageContext.pageHtmlStream = pageHtmlStream
}
Expand Down
1 change: 1 addition & 0 deletions packages/vike-react/src/integration/resolveReactOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function resolveReactOptions(pageContext: PageContext) {
// @ts-ignore
optionsAcc[fnName][key] = (...args: unknown[]) => {
valPrevious?.(...args)
// @ts-ignore
val(...args)
}
}
Expand Down
26 changes: 26 additions & 0 deletions packages/vike-react/src/types/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ConfigsCumulative } from '../hooks/useConfig/configsCumulative.js'
import type React from 'react'
import type { HydrationOptions, RootOptions } from 'react-dom/client'
import type { ServerOptions } from 'react-dom/server'
import type { RenderToStreamOptions } from 'react-streaming/server'

// https://vike.dev/meta#typescript
declare global {
Expand Down Expand Up @@ -300,7 +301,32 @@ export type ConfigViaHookResolved = Omit<ConfigViaHook, ConfigsCumulative> &
Pick<Vike.ConfigResolved, ConfigsCumulative>

export type ReactOptions = {
/**
* Options passed to React's `hydrateRoot()`.
*
* https://react.dev/reference/react-dom/client/hydrateRoot
* https://vike.dev/react-setting
*/
hydrateRootOptions?: HydrationOptions
/**
* Options passed to React's `createRoot()`.
*
* https://react.dev/reference/react-dom/client/createRoot
* https://vike.dev/react-setting
*/
createRootOptions?: RootOptions
/**
* Options passed to React's `renderToString()`.
*
* https://react.dev/reference/react-dom/server/renderToString
* https://vike.dev/react-setting
*/
renderToStringOptions?: ServerOptions
/**
* Options passed to `react-streaming`'s `renderToStream()` during SSR streaming.
*
* https://github.com/brillout/react-streaming#options
* https://vike.dev/react-setting
*/
renderToStreamOptions?: RenderToStreamOptions
}
80 changes: 40 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.