tronis
tronis
SSolidJS
Created by tronis on 4/12/2025 in #support
Preloading route data with context access
Ah ok. Any other architectures that I should consider? Should I make my store with auth info a singleton export outside of context so that my preload function can import that and read it directly? Or is that bad for some reasons I'm unaware of?
10 replies
SSolidJS
Created by tronis on 4/12/2025 in #support
Preloading route data with context access
To add some color... This happens when I reload my web app on the home endpoint which is protected by a route guard for auth. The preload runs immediately, before I've had the chance to set up my API client with my auth key. In my component tree this isn't possible since the route guard prevents renders until auth has been established / confirmed. But since the preload runs regardless of this, it runs before my auth flow has finished, and errors. I am not sure what the best practice is for architecting this in a better way such that my Home page preloads data as soon as its able to, which is earlier than when Home is rendered but later than when the route is initially matched
10 replies