The +page.svelte file at /chat/(dashboard)/[[thread_id]] receives page data with the export let data line towards the top of the file. The variable is correctly receiving the required data from the +layout.server.ts file two directories above (it needs the threads and messages).
The data in the layout is being fetched at a higher directory level so that several sub routes don't have to refetch it all the time and it would be desirable to keep it this way.
Normally, page data is automatically correctly typed (inferred) from the interface PageData in the app.d.ts file. SvelteKit will determine the type of the data based on the route location and that interface definition. For an unknown reason, it is not correctly typing the data with the +layout.server.ts data even though the data is indeed available.
The +page.svelte file at /chat/(dashboard)/[[thread_id]] receives page data with the
export let data
line towards the top of the file. The variable is correctly receiving the required data from the +layout.server.ts file two directories above (it needs the threads and messages).The data in the layout is being fetched at a higher directory level so that several sub routes don't have to refetch it all the time and it would be desirable to keep it this way.
Normally, page data is automatically correctly typed (inferred) from the
interface PageData
in the app.d.ts file. SvelteKit will determine the type of the data based on the route location and that interface definition. For an unknown reason, it is not correctly typing the data with the +layout.server.ts data even though the data is indeed available.I opened a discussion on SvelteKit's Github here: https://github.com/sveltejs/kit/discussions/12269
This chore is to find a way to get that data into the pages with correct typing without over fetching.