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 didn't see any other post on this, and I don't really know the full scope to fix the issue. I have been trying to pass page data to a story for a form I have using the parameters.sveltekit_experimental.stores per the documentation. After digging for a while, I identified the page context was updating, but the store wasn't. It has been driving me crazy for a day or so.
I think I finally found the issue. After reading through the add-on files, the mockSvelteKitStores export from storybook/code/frameworks/src/plugins/mock-sveltekit-stores.ts file is using $app/stores as the alias. I changed my form to use $app/stores instead of $app/state and the page context updated the page store. $app/stores is depreciated in Svelte 5, so is there a way to alias both $app/stores and $app/state? I don't want to break the add-on for anyone else by just trying to push an update to the alias.
import { getContext } from 'svelte';
import { page } from '$app/state';
const context = getContext('page-ctx');
$inspect('Context from form: ', context, page);
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
-
Summary
I didn't see any other post on this, and I don't really know the full scope to fix the issue. I have been trying to pass page data to a story for a form I have using the parameters.sveltekit_experimental.stores per the documentation. After digging for a while, I identified the page context was updating, but the store wasn't. It has been driving me crazy for a day or so.
I think I finally found the issue. After reading through the add-on files, the mockSvelteKitStores export from storybook/code/frameworks/src/plugins/mock-sveltekit-stores.ts file is using $app/stores as the alias. I changed my form to use $app/stores instead of $app/state and the page context updated the page store. $app/stores is depreciated in Svelte 5, so is there a way to alias both $app/stores and $app/state? I don't want to break the add-on for anyone else by just trying to push an update to the alias.
import { getContext } from 'svelte';
import { page } from '$app/state';
const context = getContext('page-ctx');
$inspect('Context from form: ', context, page);
Console output:
init"Context from form: "
{data: {test: "passed"}, form: {fail: true, missingUsername: true, missingPassword: true}}
{data: {}, error: null, form: null, params: {}, route: {id: null}, …}
Thanks!
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions