Commit Graph
1 Commits
Author SHA1 Message Date
Benjiyaya 33636200f3 fix(i18n): stop SSR crashing on Node's non-Storage localStorage global
`localStorage.getItem is not a function` aborted every server render, so the
whole UI loaded behind a Vite error overlay.

Node 22+ exposes a global `localStorage`, and without a usable
`--localstorage-file` it is a bare object with no Storage methods. The
`typeof localStorage === 'undefined'` guard therefore passed and the next call
threw. It only bit at module/component scope, because SvelteKit evaluates those
on the server too — the same guard is harmless inside onMount and $effect.

Probe for a callable method in a shared storage helper instead of trusting the
binding to exist, and route the SSR-executed reads through it.
2026-09-16 04:17:42 +08:00