Docs-addon: Error displayed when viewing non-mdx stories
See original GitHub issueDescribe the bug
When leveraging the docs plugin (@storybook/addon-docs) to render MDX files on an Angular project that has pre-existing *.stories.ts
files, an error is displayed when viewing the Docs add-on.
To Reproduce Steps to reproduce the behavior:
- Navigate to Story that is written within
*.stories.ts
file. - Select “Canvas” Tab
- Component renders properly
- Select “Docs” Tab
- See error
- Select “Canvas” Tab
- See error
Expected behavior Docs addon should be hidden or display a user friendly error if there is not documentation associated with the story. Error should not be displayed for subsequent use of storybook after seeing error.
Screenshots If applicable, add screenshots to help explain your problem.
Code snippets
System:
- OS: Windows 10
- Browser: Chrome, Edge, Firefox
- Framework: Angular
- Addons: @storybook/addon-docs
- Version: 5.2.0-alpha.41
{
...
"@storybook/addon-a11y": "5.2.0-alpha.41",
"@storybook/addon-actions": "5.2.0-alpha.41",
"@storybook/addon-docs": "5.2.0-alpha.41",
"@storybook/addon-knobs": "5.2.0-alpha.41",
"@storybook/addon-links": "5.2.0-alpha.41",
"@storybook/addon-notes": "5.2.0-alpha.41",
"@storybook/addon-viewport": "5.2.0-alpha.41",
"@storybook/addons": "5.2.0-alpha.41",
"@storybook/angular": "5.2.0-alpha.41",
...
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Docs Addon | Storybook: Frontend workshop for UI development
DocsPage is a zero-config aggregation of your component stories, text descriptions, docgen comments, props tables, and code examples into clean, readable pages.
Read more >How to make a stories.mdx file in Storybook? - Stack Overflow
Try to do it this way: import { Story, Meta, Canvas } from "@storybook/components"; import Text from "."; <Meta title="MDX/Text" ...
Read more >Storybook Docs with mdx support and addon knobs - Medium
Here's what one of our most basic stories ended up as… This will show up on the main page where we can see...
Read more >Setup CSF + MDX stories with @storybook/addon-docs - GitLab
I'm not sure where to go from there. I wonder if it would make sense to stop displaying those docs in design.gitlab.com ....
Read more >Compare DocsPage and MDX syntax in Storybook with example
card.stories.mdx --> import { Meta } from '@storybook/addon-docs/blocks'; <meta ... in a Canvas block by default where we cannot opt out of displaying...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So we have this:
Unfortunately it’s a private repo. But we’re using
notes
. I’ve just enabled DocsPage in my config:If there is only one story for the component, it renders the docs with the primary story along with the prop table (using prop-types and docgen) all correctly. As soon as I add a second story using
.add()
I get the error.