File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,10 @@ export function ViteReactSSG(
109109 )
110110 }
111111
112- const { router } = await createRoot ( true )
112+ const context = await createRoot ( true )
113+ window . __VITE_REACT_SSG_CONTEXT__ = context
114+
115+ const { router } = context
113116 const app = (
114117 < HelmetProvider >
115118 < RouterProvider router = { router ! } future = { { v7_startTransition } } />
@@ -168,6 +171,7 @@ declare global {
168171 interface Window {
169172 __VITE_REACT_SSG_STATIC_LOADER_DATA__ : any
170173 __VITE_REACT_SSG_HASH__ : string
174+ __VITE_REACT_SSG_CONTEXT__ : ViteReactSSGContext < true >
171175 }
172176}
173177
Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ export function ViteReactSSG(
8282 return
8383 }
8484
85- await createRoot ( true )
85+ const context = await createRoot ( true )
86+ window . __VITE_REACT_SSG_CONTEXT__ = context as any
8687 const app = (
8788 < HelmetProvider >
8889 { App }
Original file line number Diff line number Diff line change @@ -169,7 +169,10 @@ export function Experimental_ViteReactSSG(
169169 return
170170 }
171171
172- const { router } = await createRoot ( true )
172+ const context = await createRoot ( true )
173+ window . __VITE_REACT_SSG_CONTEXT__ = context as any
174+
175+ const { router } = context
173176 const isSSR = document . querySelector ( '[data-server-rendered=true]' ) !== null
174177 if ( ! isSSR && process . env . NODE_ENV === 'development' ) {
175178 render (
@@ -199,6 +202,8 @@ declare global {
199202 interface Window {
200203 __VITE_REACT_SSG_STATIC_LOADER_DATA__ : any
201204 __VITE_REACT_SSG_HASH__ : string
205+ // @ts -expect-error global variable
206+ __VITE_REACT_SSG_CONTEXT__ : ViteReactSSGContext < true >
202207 }
203208}
204209
You can’t perform that action at this time.
0 commit comments