diff --git a/packages/vike-react/src/+config.ts b/packages/vike-react/src/+config.ts index d9b45898..725c3cc5 100644 --- a/packages/vike-react/src/+config.ts +++ b/packages/vike-react/src/+config.ts @@ -47,6 +47,9 @@ export default { stream: { env: { server: true } }, + onAfterRenderClient: { + env: { client: true } + }, VikeReactQueryWrapper: { env: { client: true, server: true } }, diff --git a/packages/vike-react/src/renderer/onRenderClient.tsx b/packages/vike-react/src/renderer/onRenderClient.tsx index 889e1666..35291066 100644 --- a/packages/vike-react/src/renderer/onRenderClient.tsx +++ b/packages/vike-react/src/renderer/onRenderClient.tsx @@ -34,6 +34,11 @@ const onRenderClient: OnRenderClientSync = (pageContext): ReturnType void VikeReactQueryWrapper?: React.ReactNode diff --git a/packages/vike-react/src/types/PageContext.ts b/packages/vike-react/src/types/PageContext.ts index e01e8723..3eb8b220 100644 --- a/packages/vike-react/src/types/PageContext.ts +++ b/packages/vike-react/src/types/PageContext.ts @@ -1,9 +1,15 @@ // https://vike.dev/pageContext#typescript +import type React from 'react' +import type { JSX } from 'react' +import type ReactDOM from 'react-dom/client' + declare global { namespace Vike { interface PageContext { Page?: () => React.ReactNode userAgent?: string + page?: JSX.Element + root?: ReactDOM.Root } } }