Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation] No clear/documented way to use Actions alongside svelte-addon-csf #107

Closed
kyleshepherd opened this issue Jun 7, 2023 · 4 comments · Fixed by #142
Closed
Labels
documentation Changes only affect the documentation released This issue/pull request has been released.

Comments

@kyleshepherd
Copy link

There doesn't seem to be a documented way to use Actions alongside svelte-addon-csf.

When using another Story format, you can set actions as shown here.

However, I'm unable to find documentation stating how to replicate this functionality when using the Svelte CSF addon.

Is this currently possible, and if so how do you get it working?

@kyleshepherd kyleshepherd added the bug Something isn't working label Jun 7, 2023
@kyleshepherd
Copy link
Author

Found a way to do this, though I'm not sure it's the correct way;

<Meta 
  ...
  argTypes= {{
    ...
    actionName: { action: "actionName" },
  }}
/>

then

<Template let:args>
  <Component on:actionName={args.actionName} /> // `on:` whatever the event you're dispatching is called.
</Template>

An example of this should be added to the docs somewhere

@JReinhold JReinhold added documentation Changes only affect the documentation and removed bug Something isn't working labels Jul 3, 2023
@JReinhold JReinhold changed the title [Bug] No clear/documented way to use Actions alongside svelte-addon-csf [Documentation] No clear/documented way to use Actions alongside svelte-addon-csf Jul 3, 2023
@JReinhold
Copy link
Collaborator

There's also an example here that uses a slightly different approach: https://github.com/storybookjs/addon-svelte-csf/blob/main/stories/addon-actions.stories.svelte

But I agree it could be documented better.

@j3rem1e
Copy link
Contributor

j3rem1e commented Sep 16, 2023

Storybook should automatically subscribe to all discovered events for a Svelte Component. but something doesn't work here. probably because of the template proxy.

I'll try to create an issue and fix it.

@shilman
Copy link
Member

shilman commented Sep 21, 2023

🚀 Issue was released in v4.0.8 🚀

@shilman shilman added the released This issue/pull request has been released. label Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants