diff --git a/frontend/src/app.html b/frontend/src/app.html index 7f962d6..7603fb7 100644 --- a/frontend/src/app.html +++ b/frontend/src/app.html @@ -39,5 +39,59 @@
%sveltekit.body%
+ + +
+ + EventSnap +
+ diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 3ba6225..1e5a4d0 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -30,6 +30,9 @@ }); onMount(async () => { + // With `ssr = false` the server ships an empty shell; `app.html` paints a boot + // spinner to cover the JS-load gap. The app has now mounted and painted, so drop it. + document.getElementById('app-boot')?.remove(); initAuth(); // Hooks up the appliedTheme → sync. Must run early so the // first paint after hydration matches the saved preference. diff --git a/frontend/src/routes/+layout.ts b/frontend/src/routes/+layout.ts new file mode 100644 index 0000000..7806c0c --- /dev/null +++ b/frontend/src/routes/+layout.ts @@ -0,0 +1,6 @@ +// EventSnap is a client-only SPA: auth lives in localStorage (JWT) and every page fetches its +// data in onMount, so the server has nothing to render but a logged-out skeleton. Disabling SSR +// app-wide removes that dead skeleton (empty feeds, "Unbekannt" profile) and — crucially — the +// window where server-rendered interactive controls exist BEFORE hydration attaches their handlers. +// csr stays on (default). No SEO is lost (private, QR-gated app). +export const ssr = false; diff --git a/frontend/src/routes/recover/+page.svelte b/frontend/src/routes/recover/+page.svelte index 40b9bc5..351325a 100644 --- a/frontend/src/routes/recover/+page.svelte +++ b/frontend/src/routes/recover/+page.svelte @@ -5,13 +5,14 @@ import { browser } from '$app/environment'; import IconButton from '$lib/components/IconButton.svelte'; - // `from` is non-null only when we arrived here via in-app (client-side) - // navigation; on a full-page load (deep link, new tab) it's null. Using - // history.length is unreliable — a fresh tab keeps `about:blank` as the prior - // entry, so history.back() would land there instead of inside the app. + // We only want history.back() when the user actually reached /recover via in-app + // (client-side) navigation; on a cold load (deep link, new tab) history.back() would + // land on `about:blank`. `type === 'enter'` is SvelteKit's initial page load in BOTH + // SSR and CSR modes — keying on it (rather than `from === null`, which is only null on + // a cold load under SSR) keeps the check correct with `ssr = false`. let cameFromApp = $state(false); - afterNavigate(({ from }) => { - cameFromApp = from !== null; + afterNavigate(({ from, type }) => { + cameFromApp = type !== 'enter' && from !== null; }); function goBack() {