diff --git a/src/assets/views/magic_link_lobby.svelte b/src/assets/views/magic_link_lobby.svelte index 21b8eb9..2999794 100644 --- a/src/assets/views/magic_link_lobby.svelte +++ b/src/assets/views/magic_link_lobby.svelte @@ -14,7 +14,7 @@ let countdown; let validUntilDate = new Date(validUntil); - $: countdown = $locals.isPreRender ? '...' : Time.humanizeTimeTo(validUntilDate); + $: countdown = $locals.isSsr ? '...' : Time.humanizeTimeTo(validUntilDate); onMount(() => { const interval = setInterval(() => { diff --git a/src/frontend/SvelteViewEngine.ts b/src/frontend/SvelteViewEngine.ts index 3f338f8..62bc756 100644 --- a/src/frontend/SvelteViewEngine.ts +++ b/src/frontend/SvelteViewEngine.ts @@ -48,12 +48,14 @@ export default class SvelteViewEngine extends ViewEngine { const rootTemplateFile = await this.resolveFileFromCanonicalNameOrFail('templates/svelte_template.html'); const rawOutput = await this.fileCache.get(rootTemplateFile, !config.get('view.cache')); + locals.isSsr = true; const { head, html, css, } = await this.renderSvelteSsr(canonicalViewName, locals); + locals.isSsr = false; const serializedLocals = JSON.stringify(locals, (key, value) => { if (key.startsWith('_') || typeof value === 'function') return undefined; return value; diff --git a/test/assets/views/AllTests.svelte b/test/assets/views/AllTests.svelte index bbbf5a9..e837dd9 100644 --- a/test/assets/views/AllTests.svelte +++ b/test/assets/views/AllTests.svelte @@ -12,7 +12,7 @@ } -
{$locals.isPreRender ? 'SSR' : 'CSR'}
+
{$locals.isSsr ? 'SSR' : 'CSR'}