fix(documents): merge +page.server data into +page.ts return (#385)

SvelteKit's PageData type generation only picks up +page.ts return values
when both files exist, so the runtime-merged server data was invisible to
TypeScript and svelte-check flagged every q/from/to/etc access in
+page.svelte. Spreading data into the +page.ts return restores the merge
at the type level. No runtime behaviour change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-07 22:29:24 +02:00
parent e8fb8150b7
commit 8e29f428d7

View File

@@ -2,8 +2,9 @@ import { browser } from '$app/environment';
import { fetchDensity } from '$lib/document/timeline';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url, fetch }) => {
export const load: PageLoad = async ({ url, fetch, data }) => {
const view = url.searchParams.get('view');
const isDesktop = browser && window.matchMedia('(min-width: 640px)').matches;
return await fetchDensity(fetch, view, isDesktop);
const density = await fetchDensity(fetch, view, isDesktop);
return { ...data, ...density };
};