-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Meta/Story of
not available in .stories.mdx
files
#20496
Comments
facing the same error on Macbook Pro MacOS Monterey 12.5 WARN 🚨 Extraction error on src/components/atoms/button/button.stories.mdx: Error: Expected a Story name, id, or story attribute
/Users/.../node_modules/@storybook/mdx2-csf/dist/index.js:372906
throw new Error("Expected a Story name, id, or story attribute");
^
Error: Expected a Story name, id, or story attribute
at genStoryExport (/Users/.../node_modules/@storybook/mdx2-csf/dist/index.js:372906:11) |
Thanks so much for your reproduction @dev-nicolaos !! It uncovered three issues. All of these were "user errors" but which are completely impenetrable runtime errors and can be fixed with better error handling and documentation. I'm reclassifying this as a documentation issue and hopefully @JReinhold @tmeasday @yannbf can provide some help with this. I think this is confusing and will snag a bunch of users in the upgrade process. Meta/Story
|
of
syntax is only available in `.mdx files
of
syntax is only available in `.mdx filesof
construct is only available in .mdx
files
of
construct is only available in .mdx
filesof
construct is only available in .mdx
files
of
construct is only available in .mdx
files.stories.mdx
files
.stories.mdx
filesof
not available in .stories.mdx
files
@shilman thanks for your detailed response. I have a couple of thoughts about the "user errors" that you mentioned. These are from the perspective of someone who is just a user, so I understand there may be implementation details I'm unaware of that influenced these decisions.
I agree this is a really confusing restriction, especially since the pattern for the story files is explicitly declared by the user in
Makes sense. I feel like I tried that at one point and maybe something else went wrong and I reverted to the v6 (
This is really counter-intuitive. JavaScript and most if not all of the ecosystem tooling only require an entry point/pattern to be provided and the engine/tool automatically follows the import of those files to form the dependency tree. Unless this is required due to a major technical limitation of Storybook's internals, it feels like this should be changed/fixed rather than documented. Certainly feels like a step backward from v6 where this was not required. |
Thanks for the feedback @dev-nicolaos!
So I can see it's confusing why it seems that
I think we could probably make this work @shilman (maybe with a warning). I'm not sure if that's a good or a bad idea :)
What would you expect the behaviour here to be @dev-nicolaos? Would the stories referenced from an |
I'm realizing some of my expectations are driven by how I think about file names/extensions. In my mind file names/extensions should serve limited purposes:
To me, those are the reasons it makes sense to give a file that contains stories the The SB team might see it differently and that's ok, but that perspective is driving my expectations on a couple of these issues, including...
I would expect the behavior to match the existing (v6) behavior (or at least my understanding of it).
|
I guess one point that differs in 6 v 7 is:
You cannot define stories any more in So I am not quite sure that logic follows in that paradigm. Maybe it would make sense instead that the story would not appear in the sidebar but still appear in the docs file in that circumstance.
I would probably rename the |
@tmeasday I think that explanation clears up a lot of the confusion. I agree the I think the big thing to come out of this discussion for me is the need for improved documentation. I haven't read through the docs since I did the POC in late December so maybe its gotten better, but none of this was clear at the time. A lack of good API documentation for Storybook's config and doc blocks has actually been one of our team's biggest pain points in adopting the tool. It feels like you have to hunt and peck through various guides to find technical details. I'm not sure if this is because Storybook's target audience is a bit broader than just engineers, but it feels like clear, concise, and comprehensive API docs could sit alongside the longer prose-style content. |
This is good feedback, and we're actually starting to address this specifically. There is a need for more reference-type documentation alongside the existing scenario-based documentation. Luckily our first iteration of this will actually focus on the the doc blocks and docs features, which should be published in the coming weeks. |
I ran into this problem again in another design system today @JReinhold @tmeasday. The error was:
I think it should say something more like:
It's very confusing even when you know exactly how the new docs works. |
@jonniebigodes I need your input here on the docs changes we might want, based on #20496 (comment):
AFAIK we don't really mention
Should we have an explicit callout box at https://storybook.js.org/docs/7.0/react/writing-docs/mdx#anatomy-of-mdx that mentions the
I think we want to explicitly mention at https://storybook.js.org/docs/7.0/react/writing-docs/mdx#anatomy-of-mdx that any stories you reference from MDX files needs to be indexed, ie. they need to be part of the Storybook with the @jonniebigodes would you be okay with driving these docs changes? |
@JReinhold more than glad to do it. I was thinking that for items 1 and 3, we could extend the troubleshooting section and provide clarity on it. We could do a follow-up pull request based on #21615 to point at the documentation. Will that work out for you? |
@jonniebigodes sounds like a good solution! |
Gadzooks!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-rc.4 containing PR #21615 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Describe the bug
Its possible that this is another case of #19964, but none of the examples listed there matched mine so I decided to create a new issue. When trying to run
storybook start
with the repo below, I get the error:This example follows the recommendation in the Migration doc and the beta's docs to:
@storybook/blocks
of
prop to reference storiesIf I undo the latter two steps and instead:
<Meta>
doc block<Story>
component'sstory
prop to reference a storythen the build compiles successfully and I can see the stories rendering in the browser, though the docs page will still be broken.
To Reproduce
System
Additional context
The environment info spat out by
npx sb@next info
is not quite correct. I'm running Windows 11 Home 22H2 and have Firefox (108.0.1) as my default browser.The text was updated successfully, but these errors were encountered: