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

Fix Actions tab in Storybook #1154

Merged
merged 6 commits into from
Apr 4, 2023
Merged

Fix Actions tab in Storybook #1154

merged 6 commits into from
Apr 4, 2023

Conversation

jattasNI
Copy link
Contributor

@jattasNI jattasNI commented Apr 4, 2023

Pull Request

🤨 Rationale

After #1134, the Actions tab in Storybook was no longer displaying events fired by components. This is one of the issues tracked in #1146.

As described in the Storybook 7 migration guide, the actions addon is no longer enabled by default and it must be enabled by configuring the story with decorators: [withActions]. However, the withActions decorator wasn't exported from Storybook in a way that we could import it (see storybookjs/storybook#21887). A Storybook dev commented on that issue with a workaround that we can use until they fix that bug.

👩‍💻 Implementation

  1. Add a TypeScript shorthand ambient module declaration for the import URL that contains withActions. See /utilities/tests/storybook-declarations.d.ts.
  2. Update all stories that expose an action to import withActions and configure it as a decorator (also reordered a few imports to group them by package)
  3. Update the depth of event data exposed by actions since the meaning of that parameter appears to have changed. [Bug]: configureActions depth parameter changed behavior between Storybook 6.5 and 7.0 storybookjs/storybook#21933

🧪 Testing

Manually verified many of the stories that have actions are now firing them.

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@jattasNI jattasNI marked this pull request as ready for review April 4, 2023 14:42
@jattasNI jattasNI requested a review from fredvisser April 4, 2023 14:42
@jattasNI jattasNI enabled auto-merge (squash) April 4, 2023 14:42
@jattasNI jattasNI merged commit 995d7c2 into main Apr 4, 2023
@jattasNI jattasNI deleted the users/jattas/storybook-actions branch April 4, 2023 22:19
@jattasNI jattasNI mentioned this pull request Apr 4, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants