storybook
storybook copied to clipboard
[Bug]: `SB_PREVIEW_API_0001 (MissingStoryAfterHmrError)` when linking Story from "composed" SB instances
Describe the bug
I have a main SB instance in which I write my MDX documentation using @storybook/addon-docs. I have a couple more SB instances connected to the main instance via the composition feature.
I'm trying to render stories present in each instances, side by side, using the <Story/>
component, along with its id
prop as described in the "Linking to other stories and pages" section of the doc.
Stories that are coming from the main SB instance are rendered correctly. However, stories from instances that are referenced from composed SB (via the refs in main.js) are not rendered, and are causing the error:
SB_PREVIEW_API_0001 (MissingStoryAfterHmrError)
Couldn't find story matching id 'ref1_foo--primary' after HMR.
- Did you just rename a story?
- Did you remove it from your CSF file?
- Are you sure a story with the id 'ref1_foo--primary' exists?
- Please check the values in the stories field of your main.js config and see if they would match your CSF File.
- Also check the browser console and terminal for potential error messages.
To Reproduce
Follow instructions in the README of this repo.
System
Storybook Environment Info:
System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Pro
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v18.15.0/bin/yarn <----- active
npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
Browsers:
Chrome: 120.0.6099.234
Safari: 17.2.1
npmPackages:
@storybook/addon-docs: 7.4.5 => 7.4.5
@storybook/addon-essentials: ^7.6.10 => 7.6.10
@storybook/addon-interactions: ^7.6.10 => 7.6.10
@storybook/addon-links: ^7.6.10 => 7.6.10
@storybook/addon-onboarding: ^1.0.10 => 1.0.10
@storybook/blocks: ^7.6.10 => 7.6.10
@storybook/preset-create-react-app: ^7.4.5 => 7.6.10
@storybook/react: ^7.6.10 => 7.6.10
@storybook/react-webpack5: ^7.6.10 => 7.6.10
@storybook/testing-library: ^0.2.2 => 0.2.2
storybook: ^7.6.10 => 7.6.10
Additional context
I can't tell if this is just not supported, if I'm using a combination of versions that prevents this to work correctly, or if that's an actual bug. I have not find any evidence in the docs or other issues in the repo that could confirm either.
@shilman I would love to help taking a stab at this issue, and before I start digging into SB vast codebase, I would welcome any pointers / high level guidance on what troubleshooting to do to pinpoint this bug. Curious also if you know whether this is a recent bug and used to work with older versions of SB or not.