-
-
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
Improve error reporting for duplicate story definitions #19094
Comments
@Niznikr thanks for the report. Is there any chance you can share a link to the project, or create a minimal reproduction? Also, have you confirmed that you don't have multiple stories files with the same |
Hi @IanVS! I will try to get a minimal reproduction for you tomorrow. I have confirmed that I don't have multiple stories with the same title. It even happens when I update the regex to target a single story. |
So I was able to re-enable
It seems past |
It was |
To be clear, it seemed to match the individual |
@IanVS usually stories globs matching inside |
Thanks @shilman. It sounds like maybe something changed in recent alpha versions, though, according to @Niznikr. They said it was not matching stories in node_modules until recently. They updated storybook, and started to get failures. @Niznikr if you can find the exact alpha version where this started, we could probably trace down the reason and figure out whether it was intentional or not. Also BTW, I'm in Ann Arbor as well! Maybe we'll run into each other sometime. ;) |
Sure @IanVS I can narrow down where it started. So cool to hear you're in the area! I'm usually at a RoosRoast, Hyperion, or some other coffee shop in the morning :P Would be fun to chat sometime. |
It started in |
I don't see anything jumping out to me in https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.12 that would indicate this is an intentional change. @tmeasday it looks like most of those are your PRs. Does it make sense that stories in node_modules would start being included in globs in this release? |
That release includes the PRs that include the error that is being thrown here, but AFAIK nothing that would influence the files that are processed by the indexer. So I'd hazard a guess that maybe the file was being processed before but it just didn't lead to an error? Couple questions @Niznikr:
If I am correct about the above, I am not sure we would consider it a bug that you aren't allowed to have two "different" files that define the same story. Arguably allowing one to clobber the other was the real bug 🤷 |
|
@shilman WDYT about this new behaviour? Do we consider it a bug? Do we need to document it? |
We are afected by this too and the stricter regex isn't helping us out, We are at alpha.52
(in our configuration we don't use most of the addons, we may have to clean up a bunch of the dependencies ASAP) we are also using I will try to keep on debugging on this, but any leads or help on how I should go around the debugging of this would be extremely appreciated |
@yuri-scarbaci-lenio, are you using a similar project structure to #19094 (comment), where stories from linked packages are being included? If not, I would suggest searching through your stories for two of them using the same Maybe you can describe your project structure a bit? |
@yuri-scarbaci-lenio would you be interested in submitting a PR doing that? I'd be very happy to review it. Otherwise I'll get to this eventually as part of the 7.0 release cycle. |
Using It should be documented if there is no will to prevent this (the question is maybe, is it too specific to |
@tmeasday sorry for the slow reply (notifications hell!). i think the console error makes sense |
Here's an idea: The consumer of the JSON could then do something with that array of problems.. storybook could display the problems in it's UI somewhere. We can't send an event on some channel, because the browser doesn't open / start listening to the channel yet, until the StoryIndexGenerator is completed. |
My 2 cents as per
Whatever you choose to do with this particular problem, I think this solution should be an extension of a more abstract and generic layer, the "error handling" layer Based on what it's stated above I think the layer should be at the very least be capable of handling different type of errors,
And such layer should provide different configuration regarding the output of such catched errors, the bare minimum imho would be:
I personally would put the
as a nice to have If this was to be planned correctly, sharing the errors would be a problem reduced to "sharing the error layer", which should be a much simpler problem to solve given that storybook developer mode start is actually mounting a pseudo-server... |
@yuri-scarbaci-lenio you are scratching the surface of an issue that's been discussed elsewhere (that there are like a dozen different types of errors you can trigger in SB and we don't really handle them consistently at all). I'm not sure for 7.0 we are likely to resolve that. However, if we stick to just these errors on static analysis and index generation, then there are a few concerns:
I would suggest that (3) is out of scope for 7.0, and would probably be considered as part of the first discussion. But 1&2 are totally in scope and I think we should rationalize it alongside #20044 |
I see, Do you have a RFC or some publicly available centralised discussion regarding the error handling layer? |
Describe the bug
This is for a pnpm monorepo project migrating from
7.0.0-alpha.10
webpack React (which works perfectly) to7.0.0-alpha.28
with the Vite framework. I get the following error whenstoryStoreV7
is true:The console shows:
I validated that the same error appears for
@storybook/react-webpack5
past version7.0.0-alpha.10
. Not sure how to proceed as nothing was changed besides bumping the alpha version.System
System:
OS: macOS 12.5.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.15.0 - /usr/local/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.5.5 - /usr/local/bin/npm
Browsers:
Chrome: 105.0.5195.52
Firefox: 104.0.1
Safari: 15.6.1
npmPackages:
@storybook/addon-a11y: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-actions: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-backgrounds: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-docs: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-essentials: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-highlight: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-interactions: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-measure: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addon-outline: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/addons: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/api: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/channel-postmessage: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/channel-websocket: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/cli: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/client-api: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/client-logger: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/components: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/core-client: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/core-events: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/preview-web: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/react: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/react-vite: ^7.0.0-alpha.28 => 7.0.0-alpha.28
@storybook/testing-library: ^0.0.13 => 0.0.13
@storybook/theming: ^7.0.0-alpha.28 => 7.0.0-alpha.28
Additional context
Stories are written in CSF3.
The text was updated successfully, but these errors were encountered: