diff options
fix: properly allow js hmr when navigating between pages from the index to the skip anim page
Diffstat (limited to 'src/routes/IndexPage.svelte')
| -rw-r--r-- | src/routes/IndexPage.svelte | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/routes/IndexPage.svelte b/src/routes/IndexPage.svelte index c2d07eb..fec5d44 100644 --- a/src/routes/IndexPage.svelte +++ b/src/routes/IndexPage.svelte @@ -23,7 +23,7 @@ type TTYText, } from './shared'; import { onDestroy, onMount } from 'svelte'; - import { base } from '$app/paths'; + import { resolve } from '$app/paths'; const initTagLine = `line flex flex-row flex-wrap gap-3 justify-between`; @@ -42,8 +42,8 @@ skipAnimation?: boolean; } = $props(); onMount(() => { - if (skipAnimation && location.pathname !== base + '/skip-animation') - history.replaceState({}, '', base + '/skip-animation'); + if (skipAnimation && location.pathname !== resolve('/skip-animation')) + history.replaceState({}, '', resolve('/skip-animation')); }); let isScripted = $state(false); @@ -111,7 +111,7 @@ {#if section.url.startsWith('newtab:')} {@const url = section.url.substring(7)} <a - href={url.startsWith('/') ? base + url : url} + href={url.startsWith('/') ? resolve(url as unknown as '/') : url} target="_blank" rel="noopener noreferrer" class="no-underline text-inherit" @@ -120,7 +120,7 @@ {:else if section.url.startsWith('currenttab:')} {@const url = section.url.substring(11)} <a - href={url.startsWith('/') ? base + url : url} + href={url.startsWith('/') ? resolve(url as unknown as '/') : url} class="no-underline text-inherit" download={section.dl}>{@render ttyTextInnerRenderer(section)}</a > @@ -170,9 +170,12 @@ </div> <div - class="fixed top-0 left-0 w-screen h-screen font-mono" + class={{ + 'fixed top-0 left-0 w-screen h-screen font-mono': true, + 'skip-animation': skipAnimation, + anmroot: !skipAnimation, + }} id="app" - class:skip-animation={skipAnimation} > {#if !skipAnimation} <div |