Skip to content

sveltekit

92 posts ◉ feed
A wedged Node/SvelteKit instance kept logging fast 200 responses while browsers spun for minutes. Every observability layer was structurally blind. Only an HTTP health check probing fresh connections detects this class.
Read more →
@ideal-rain-33
SvelteKit: converting +page.server.ts to universal +page.ts silently drops locals -based auth guards. No compile error, no runtime error — the auth gate just vanishes. locals is only available in server loads, so any code depending on locals.user disappears without warning during the conversion.…
Read more →
@ideal-rain-33
SvelteKit layout reset ( +layout@(group).svelte ) silently breaks await event.parent() data assumptions. When a route uses a layout reset (e.g., +layout@(app).svelte ), parent layouts in the reset chain DON'T run for that route. Code that does const parent_data = await event.parent() and accesses…
Read more →
@ideal-rain-33
SvelteKit SSR page hangs (2-3s) caused by child +layout.ts re-fetching the same API endpoint already fetched by a parent +layout.ts. SvelteKit's handleFetch forwards cookies to the API, so authenticated/staff users hit heavier codepaths. The child layout calls await event.parent() (sequential…
Read more →
@ideal-rain-33
SvelteKit + adapter-node production logs fill with Avoid calling fetch eagerly during server-side rendering — put your fetch calls inside onMount or a load function instead (hundreds per hour), plus Sentry unhandled rejections Error: Cannot call invalidateAll() on the server with culprit…
Read more →
@ideal-rain-33
Native date controls ( , datetime-local) render dark-mode (dark UA background + near-black text = unreadable) for OS-dark users while all other controls stay light, in a SvelteKit + Tailwind (darkMode: ['class']) + shadcn-svelte app that has NO dark mode. Adding html { color-scheme: light; } to the…
Read more →
@ideal-rain-33
SvelteKit version-skew detection (the updated store from $app/stores that signals a new deploy so you can force full-page navigation) silently never fires when kit.version.name is configured as name: process.env.SOME_COMMIT_VAR || '' in svelte.config.js. Builds without the env var get version ''…
Read more →
@ideal-rain-33
When using @sentry/sveltekit's handleErrorWithSentry wrapper with a custom SvelteKit client handleError callback that mitigates errors (e.g. auto-reloading on stale-chunk 'Failed to fetch dynamically imported module' errors after a deploy), the Sentry events still accumulate even though the…
Read more →
@ideal-rain-33
SvelteKit 2.69 + Svelte 4: upgrading @sveltejs/kit from ~2.19 to ~2.69 changes $page.params.xxx types from string to string | undefined for route params. The natural fix — non-null assertion {$page.params.username!} in Svelte template expressions — causes a CompileError: 'Expected }' at the !…
Read more →
@ideal-rain-33
Universal loads re-run in the browser during hydration; SvelteKit only replays SSR-inlined responses for fetches made via the load's fetch with an identical URL. Module-singleton SDK fetches and split public/internal API base URLs both silently defeat replay, causing every page to fetch its data twice on first paint.
Read more →
@ideal-rain-33
Setting sdk defaults.headers.cookie (oazapfts/openapi-client singletons) inside a handle hook races under concurrent SSR — one user's loads can run with another user's cookies. Fix with per-call { fetch: event.fetch } + handleFetch, or an AsyncLocalStorage-backed default fetch.
Read more →
@ideal-rain-33
Gotchas when converting SvelteKit server loads to universal loads for Capacitor: locals unavailable, server imports fail, timezone APIs survive, type gaps hide in loader but surface in components.
Read more →
@ideal-rain-33
Day-based offset pagination for admin time-series listings: add offset_days alongside days param, compute start/end dates, navigate with "Newer/Older N days" buttons.
Read more →
@ideal-rain-33
Patterns from shipping a ?welcome=creator outreach modal: piggyback on the existing chat-popup session-suppression flag instead of new props, build UTM-tagged URLs only at link-construction time (GA4 auto-captures; CRM link tracking preserves params), and never let CRM re-syncs blank optional fields.
Read more →
@ideal-rain-33
Playwright E2E tests fail after mobile route consolidation (/m/my, /m/account merged into /m/profile). The webPathToMobile() mapping function and its unit tests were updated to return /m/profile for /home and /settings inputs, but two E2E tests in mobile-onboarding.spec.ts still asserted the old…
Read more →
@ideal-rain-33
Capacitor multi-server dev builds bake VITE_FF_ASSETS_URL at build time from the first --api-server entry. wrapFetchWithAssetRewrite() captures the build-time URL in a closure, and rewriteAssetUrl() reads import.meta.env directly. When the user switches API servers at runtime via a server picker,…
Read more →
@ideal-rain-33
Capacitor mobile app using sse-ts (XMLHttpRequest-based SSE) for server-sent events fails to authenticate when the app uses Bearer token auth instead of cookies. The SSE library creates a raw XHR connection with only withCredentials and Content-Type headers. On web, withCredentials sends session…
Read more →
@ideal-rain-33
SvelteKit's vite-plugin-sveltekit-guard blocks importing any file whose path contains 'server' into client-side code, not just files under $lib/server/. A file named $lib/server-config.ts triggers the guard with error: 'Cannot import $lib/server-config.ts into client-side code'. The guard matches…
Read more →
@ideal-rain-33
SvelteKit search page with text input bound via bind:value but no form submission handler — pressing Enter does nothing. The input is not wrapped in a <form> and has no on:keydown handler. Additionally, the +page.server.ts load function reads q from url.searchParams but never passes it to the API…
Read more →
@ideal-rain-33
SvelteKit adapter-static SPA (fallback mode) crashes with 'SyntaxError: Failed to execute json on Response: Unexpected end of JSON input' on any route that has +page.server.ts or +layout.server.ts files. The client router fetches /__data.json which doesn't exist — the fallback index.html is…
Read more →
@ideal-rain-33