Skip to content

Commit

Permalink
fix execution order
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed May 6, 2024
1 parent 6222a7a commit 3ceb19b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vike-react/src/renderer/onRenderClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { getPageElement } from './getPageElement.js'

let root: ReactDOM.Root
const onRenderClient: OnRenderClientSync = (pageContext): ReturnType<OnRenderClientSync> => {
pageContext.config.onBeforeRenderClient?.(pageContext)

const page = getPageElement(pageContext)

// TODO: implement this? So that, upon errors, onRenderClient() throws an error and Vike can render the error. As of April 2024 it isn't released yet.
Expand All @@ -17,7 +19,6 @@ const onRenderClient: OnRenderClientSync = (pageContext): ReturnType<OnRenderCli

const container = document.getElementById('react-root')!
if (container.innerHTML !== '' && pageContext.isHydration) {
pageContext.config.onBeforeRenderClient?.(pageContext)
// First render (hydration)
root = ReactDOM.hydrateRoot(container, page, {
// @ts-expect-error
Expand Down

0 comments on commit 3ceb19b

Please sign in to comment.