From 76bfc38a095a65600793b7c6bbfa97f7145cc328 Mon Sep 17 00:00:00 2001 From: Arunoda Susiripala Date: Wed, 5 Apr 2017 17:13:34 +0530 Subject: [PATCH] Remove all the inline code. --- client/index.js | 10 +++++++++- server/document.js | 15 +++------------ server/index.js | 12 ++++++++++++ server/render.js | 30 ++++++++++++++++++++++++------ 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/client/index.js b/client/index.js index fc32fc6e..bf5cb423 100644 --- a/client/index.js +++ b/client/index.js @@ -35,7 +35,15 @@ if (window.NEXT_LOADED_PAGES) { } const ErrorComponent = pageLoader.loadPageSync('/_error') -const Component = pageLoader.loadPageSync(pathname) || ErrorComponent +let Component + +try { + Component = pageLoader.loadPageSync(pathname) +} catch (err) { + console.error(`${err.message}\n${err.stack}`) + Component = ErrorComponent +} + let lastAppProps export const router = createRouter(pathname, query, getURL(), { diff --git a/server/document.js b/server/document.js index 6bc92371..7160aeeb 100644 --- a/server/document.js +++ b/server/document.js @@ -95,25 +95,16 @@ export class NextScript extends Component { return this.getChunkScript('app.js', { async: true }) } - getMainComponents () { - const { component, errorComponent } = this.context._documentProps - - return ( -
-