Skip to content

Commit

Permalink
Move wrapApp
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Aug 11, 2022
1 parent 14b6105 commit 4e14053
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/next/client/index.tsx
Expand Up @@ -289,6 +289,18 @@ export async function initialize(opts: { webpackHMR?: any } = {}): Promise<{
return { assetPrefix: prefix }
}

const wrapApp =
(App: AppComponent) =>
(wrappedAppProps: Record<string, any>): JSX.Element => {
const appProps: AppProps = {
...wrappedAppProps,
Component: CachedComponent,
err: initialData.err,
router,
}
return <AppContainer>{renderApp(App, appProps)}</AppContainer>
}

export async function hydrate(opts?: { beforeRender?: () => Promise<void> }) {
let initialErr = initialData.err

Expand Down Expand Up @@ -396,18 +408,6 @@ export async function hydrate(opts?: { beforeRender?: () => Promise<void> }) {
await window.__NEXT_PRELOADREADY(initialData.dynamicIds)
}

const wrapApp =
(App: AppComponent) =>
(wrappedAppProps: Record<string, any>): JSX.Element => {
const appProps: AppProps = {
...wrappedAppProps,
Component: CachedComponent,
err: initialData.err,
router,
}
return <AppContainer>{renderApp(App, appProps)}</AppContainer>
}

router = createRouter(initialData.page, initialData.query, asPath, {
initialProps: initialData.props,
pageLoader,
Expand Down

0 comments on commit 4e14053

Please sign in to comment.