From a41e3c102e509db93f62be34eb782f73e43f95a7 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sun, 5 Aug 2018 15:53:34 -0700 Subject: [PATCH] Await preloading right before rendering the page (#4896) --- server/render.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/render.js b/server/render.js index 35d62a27..e35292d4 100644 --- a/server/render.js +++ b/server/render.js @@ -72,8 +72,6 @@ async function doRender (req, res, pathname, query, { require(appPath) ]) - await Loadable.preloadAll() // Make sure all dynamic imports are loaded - Component = Component.default || Component if (typeof Component !== 'function') { @@ -143,6 +141,8 @@ async function doRender (req, res, pathname, query, { return { html, head, errorHtml, buildManifest } } + await Loadable.preloadAll() // Make sure all dynamic imports are loaded + const docProps = await loadGetInitialProps(Document, { ...ctx, renderPage }) const dynamicImports = getDynamicImportBundles(reactLoadableManifest, reactLoadableModules)