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
I have a couple components that would need data from svelte +page.server.ts file. The functions use private env vars and can't be included on the client side.
What's a good way to mimic the functionality of the load function in +page.server.ts in sveltekit? I've tried putting a +page.server.ts alongside my .story.svelte file (hoping it would be triggered before the .story.svelte was displayed (similar to how sveltekit works)), but can't seem to figure out how to trigger anything in the +page.server.ts file.
I saw there was a way to config Histoire with a server-setup file, (and I have) but how can I use functions defined in the server-setup file? I see a console.log but can't figure out how to call functions defined in the server setup file.
Should I just mock out the data like I would in a test? (My concern here is that my types will get out of sync - i.e. mock the data and then that data shape doesn't stay consistent in the real world implementation)
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a couple components that would need data from svelte +page.server.ts file. The functions use private env vars and can't be included on the client side.
What's a good way to mimic the functionality of the load function in +page.server.ts in sveltekit? I've tried putting a +page.server.ts alongside my .story.svelte file (hoping it would be triggered before the .story.svelte was displayed (similar to how sveltekit works)), but can't seem to figure out how to trigger anything in the +page.server.ts file.
I saw there was a way to config Histoire with a server-setup file, (and I have) but how can I use functions defined in the server-setup file? I see a console.log but can't figure out how to call functions defined in the server setup file.
Should I just mock out the data like I would in a test? (My concern here is that my types will get out of sync - i.e. mock the data and then that data shape doesn't stay consistent in the real world implementation)
Thanks for the help!
Beta Was this translation helpful? Give feedback.
All reactions