You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting up my hooks.server.ts to be a clean entry point and do the following.
Initialize some things for server to use, put them on event.locals. ✅
Initialize some things for client to use, put them on $page.data (like a universal load function) ❌
I can't figure out how to do step 2 without creating another file to handle this (+layout). Since this new layout file will only have around 3 lines of code (returning a local), it feels a little odd and like I could handle this higher up the pipeline.
It would be cool if when doing await resolve() I could pass in page data and locals to be factored in when rendering an event. If I could/can do something like the following, it would fix a lot of issues I've had with dir based routing in SvelteKit.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Setting up my
hooks.server.ts
to be a clean entry point and do the following.event.locals
. ✅$page.data
(like a universal load function) ❌I can't figure out how to do step 2 without creating another file to handle this (
+layout
). Since this new layout file will only have around 3 lines of code (returning alocal
), it feels a little odd and like I could handle this higher up the pipeline.It would be cool if when doing
await resolve()
I could pass in page data and locals to be factored in when rendering an event. If I could/can do something like the following, it would fix a lot of issues I've had with dir based routing in SvelteKit.Has anyone seen any similar patterns or other ways of doing this? TIA
Beta Was this translation helpful? Give feedback.
All reactions