From 5627702f84d0b38e425b904ae04ed192a38f7025 Mon Sep 17 00:00:00 2001 From: thebells1111 Date: Sat, 26 Oct 2019 22:43:37 -0500 Subject: [PATCH] changed handle_error and index segments Right now, the 'segment' prop that is passed to `_layout.svelte` will be undefined for both the index page, and for the error handling page. This will change the segments to `['index']` and `['_error']` respectively. Being able to differentiate between the two pages in the `segment` prop will allow the designer greater control over determining how the page is displayed, such as changing the Nav appearance based upon the segment sent. --- runtime/src/app/app.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/src/app/app.ts b/runtime/src/app/app.ts index 95b882fd0..daaed4c77 100644 --- a/runtime/src/app/app.ts +++ b/runtime/src/app/app.ts @@ -145,7 +145,7 @@ export function handle_error(url: URL) { }, component: ErrorComponent }, - segments: preloaded + segments: ['_error'] } const query = extract_query(search); @@ -274,7 +274,8 @@ export async function hydrate_target(target: Target): Promise<{ branch?: Array<{ Component: ComponentConstructor, preload: (page) => Promise, segment: string }>; }> { const { route, page } = target; - const segments = page.path.split('/').filter(Boolean); + const segments = page.path === '/' ? ['index'] : page.path.split('/').filter(Boolean); + let redirect: Redirect = null;