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
Storybook: Make description-loader more reliable #40616
Conversation
Size Change: 0 B Total Size: 1.23 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 The warning is gone, and the story description is still being shown like before.
Not related to changes in this PR, but inspired by https://github.com/WordPress/gutenberg/pull/40164/files#r859619333 I tried passing parameters
to a story (e.g. adding WithCustomUnits.parameters = {};
as the last line of packages/components/src/unit-control/stories/index.tsx
), and effectively that makes the description go away from the rendered story. Not sure if we can do anything about it, though
0124658
to
dc01a3b
Compare
Great point, and I'm happy to report that I figured it out! This PR is now more about that bug fix rather than the deprecation fix. I've updated the PR description with new instructions. Ready for another spin 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point, and I'm happy to report that I figured it out! This PR is now more about that bug fix rather than the deprecation fix.
Works like a charm! And the warning is gone too 🚀
What?
Two bug fixes:
MyStory.parameters = {}
statements in the code.MyStory.story.parameters.docs.storyDescription
MyStory.parameters.docs.description.story
Why?
The webpack loader code added in #39165 was naive in a few ways:
MyStory.story.parameters.docs.storyDescription = "foo"
statement right after the named export statement, meaning that any existing statements in the code after that likeMyStory.parameters = { ... }
could erase the story description.Testing Instructions
npm run storybook:dev
Go to the Docs view of
UnitControl
.In the story file for that component, pick a story with a JSDoc comment description. Add some custom config like:
In this case, the explicit story description should be shown in the Docs view.
Remove the explicit description from the code. Now, the JSDoc comment description should be shown in the Docs view.
The console warnings below shouldn't be thrown anymore.