From 9eaabf93c65ebbae10ee074ef4faee3f989b0002 Mon Sep 17 00:00:00 2001 From: Anudeep Reddy Date: Wed, 11 Aug 2021 00:41:40 +0530 Subject: [PATCH 1/3] import fallback components only when required --- packages/kit/src/core/create_app/index.js | 2 +- packages/kit/src/runtime/client/renderer.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/kit/src/core/create_app/index.js b/packages/kit/src/core/create_app/index.js index ea84e02392c0..b5a1137c8784 100644 --- a/packages/kit/src/core/create_app/index.js +++ b/packages/kit/src/core/create_app/index.js @@ -102,7 +102,7 @@ function generate_client_manifest(manifest_data, base) { export const routes = ${routes}; - export const fallback = [c[0](), c[1]()]; + export const fallback = [c[0], c[1]]; `); } diff --git a/packages/kit/src/runtime/client/renderer.js b/packages/kit/src/runtime/client/renderer.js index 4b1fdd10b783..7d9cbfb1f840 100644 --- a/packages/kit/src/runtime/client/renderer.js +++ b/packages/kit/src/runtime/client/renderer.js @@ -60,7 +60,7 @@ function initial_fetch(resource, opts) { export class Renderer { /** @param {{ * Root: CSRComponent; - * fallback: [CSRComponent, CSRComponent]; + * fallback: [() => CSRComponent, () => CSRComponent]; * target: Node; * session: any; * host: string; @@ -708,7 +708,7 @@ export class Renderer { }; const node = await this._load_node({ - module: await this.fallback[0], + module: await this.fallback[0](), page, context: {} }); @@ -718,7 +718,7 @@ export class Renderer { await this._load_node({ status, error, - module: await this.fallback[1], + module: await this.fallback[1](), page, context: (node && node.loaded && node.loaded.context) || {} }) From 1b19baf6740a30b231ee08bb23b34b443bc494c1 Mon Sep 17 00:00:00 2001 From: Anudeep Reddy Date: Wed, 11 Aug 2021 00:53:02 +0530 Subject: [PATCH 2/3] added tests for 9eaabf9 --- packages/kit/test/apps/basics/src/routes/__layout.svelte | 9 +++++++++ .../apps/basics/src/routes/nested-layout/reset/_tests.js | 4 ++++ .../basics/src/routes/nested-layout/reset/index.svelte | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/kit/test/apps/basics/src/routes/__layout.svelte b/packages/kit/test/apps/basics/src/routes/__layout.svelte index 070de74c9f47..ba55b284a45c 100644 --- a/packages/kit/test/apps/basics/src/routes/__layout.svelte +++ b/packages/kit/test/apps/basics/src/routes/__layout.svelte @@ -1,4 +1,6 @@ @@ -31,7 +34,7 @@ export let foo; - +