From 4e14053e27cd6bcd37b0a06795b8f1bdfa166736 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 11 Aug 2022 19:41:52 +0200 Subject: [PATCH] Move wrapApp --- packages/next/client/index.tsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/next/client/index.tsx b/packages/next/client/index.tsx index fd44ba7a7b34..9b5086028300 100644 --- a/packages/next/client/index.tsx +++ b/packages/next/client/index.tsx @@ -289,6 +289,18 @@ export async function initialize(opts: { webpackHMR?: any } = {}): Promise<{ return { assetPrefix: prefix } } +const wrapApp = + (App: AppComponent) => + (wrappedAppProps: Record): JSX.Element => { + const appProps: AppProps = { + ...wrappedAppProps, + Component: CachedComponent, + err: initialData.err, + router, + } + return {renderApp(App, appProps)} + } + export async function hydrate(opts?: { beforeRender?: () => Promise }) { let initialErr = initialData.err @@ -396,18 +408,6 @@ export async function hydrate(opts?: { beforeRender?: () => Promise }) { await window.__NEXT_PRELOADREADY(initialData.dynamicIds) } - const wrapApp = - (App: AppComponent) => - (wrappedAppProps: Record): JSX.Element => { - const appProps: AppProps = { - ...wrappedAppProps, - Component: CachedComponent, - err: initialData.err, - router, - } - return {renderApp(App, appProps)} - } - router = createRouter(initialData.page, initialData.query, asPath, { initialProps: initialData.props, pageLoader,