From b660ba796a29edb796f664f75535f5822935cc4f Mon Sep 17 00:00:00 2001 From: Puru Vijay Date: Thu, 16 Feb 2023 02:38:20 +0530 Subject: [PATCH] Minor refactor --- sites/svelte.dev/src/routes/docs/+page.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sites/svelte.dev/src/routes/docs/+page.svelte b/sites/svelte.dev/src/routes/docs/+page.svelte index ecf250461d..621f355802 100644 --- a/sites/svelte.dev/src/routes/docs/+page.svelte +++ b/sites/svelte.dev/src/routes/docs/+page.svelte @@ -11,15 +11,15 @@ $page.url.hash.replace('#', '').startsWith(val.path.split('/').at(-1)) ); - if (!section) goto('/docs/introduction'); + if (!section) return '/docs/introduction'; // Remove the section name from hash, then redirect to that const hash = $page.url.hash.replace(`#${section.path.split('/').at(-1)}-`, ''); - goto(`${section.path}#${hash}`); + return `${section.path}#${hash}`; } onMount(() => { - getURlToRedirectTo(); + goto(getURlToRedirectTo()); });