:: krowemoh

Thursday | 26 DEC 2024
Posts Links Other About Now

previous
next

Sveltekit Load

2022-05-21

A strange issue I ran into was that the load function in my layout file wasn't running on param changes even though it should. I'm guess there might be something strange going on there, luckily including url as part of the load function made it reactive.

Sveltekit seems to have some really weird stuff, the documentation is good but there isn't much community help and its tough to even word what the problem is. In this case it took awhile to figure out that the load function was running intermittently. It was only on the first page load that the params wasn't getting picked up and re-running the load function. Once I refreshed the page, it was fine. Restarting the app would bring the problem back until I refreshed.

This seems to be the downside of using a framework. I think I would have much preferred to have written this as a traditional app. Another alternative could have been to structure a backend and a frontend properly instead of trying to use sveltekit to do both.