defenseunicorns / leapfrogai

Production-ready Generative AI for local, cloud native, airgap, and edge deployments.
https://leapfrog.ai
Apache License 2.0
245 stars 25 forks source link

chore(ui): PageData typing for chat page #587

Open andrewrisse opened 1 month ago

andrewrisse commented 1 month ago

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.

andrewrisse commented 4 weeks ago

Update: I changed the way the data is fetched and it's now in a +page.server.ts file, but it still has a typing issue