-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Error: Couldn't find story matching '' after HMR #459
Comments
I've had this too, I think it's an improper export of the // App.tsx
import StorybookUIRoot from '../../.storybook/Storybook';
const StoryBookApp = () => (
<StorybookUIRoot />
);
export default StoryBookApp; |
hey, sorry only just saw this. Do you have any story selected when the error happens or is it only when there are no stories? |
For me, I haven't managed to render a story yet, because I'm stuck on this error. |
For me, this happens when
|
can you confirm the version of storybook you are using? |
Is it OK that I am involved in this too? I don't wanna be impolite and hijack this. |
Avoid using any v7 package as v6 is not compatible with v7. Also you should update to 6.5.3 for |
6.5.2. Heres a repro: https://github.com/arthuralee/rn-sb-hmr-bug-repro |
Getting the same error on these versions:
I got to these versions by following this readme |
@LaurensUP oops! I guess I need to update that readme, thanks for pointing it out 🙏 |
Thanks! @arthuralee really appreciate the repro. Unfortunately this week I'm crazy busy with work but I promise to take a proper look as soon as I can. |
I've managed to get passed this issue and get a storybook running. Even though I'm not sure how. |
Update I had everything set up and working, but when modifying the stories I ran into a very similar errormsg:
Even though I don't have a react-native-button--basic story anywhere. |
This is how I can reproduce the original error:
|
Does the |
No you just need a title to exist , the error is more likely the asyncstorage key is out of sync. Have you tried reinstalling the app? |
Make sure you have also ran the script to generate the stories imports. |
@arthuralee I've gotten some progress by restarting Metro with the # start Metro
npm start -- --reset-cache It seems that the bundle is confused/corrupted with bad imports somehow. Also, this is how I'm currently importing Storybook: // src/app/App.tsx
const mainApp = <Root />
const storyBookApp =<StorybookUIRoot/>
const storyBookEnabled = true;
const App = () => {
useTracking();
return (
<AppProviders>
<AppInitializer>
{ storyBookEnabled ? storyBookApp : mainApp}
</AppInitializer>
</AppProviders>
);
}; // .storybook/Storybook.tsx
import { getStorybookUI } from '@storybook/react-native';
import './storybook.requires';
const StorybookUIRoot = getStorybookUI({});
export default StorybookUIRoot; |
@arthuralee sorry its taken me a while but I ran your repro and got no errors. Do I need to follow any steps to make the error happen? |
@dannyhw apologies, i may have messed up the repro. I've fixed it now and am still able to repro with the latest version. Here are my exact steps after cloning the repo:
The key here is that the storybook UI root component is imported into the module tree but not rendered. This is common if we want Storybook to be a secondary screen within the app. If we render the storybook UI right away as the App entry point, this issue does not repro. |
@arthuralee do you have sbmodern in your metro resolvers config? |
Yep: https://github.com/arthuralee/rn-sb-hmr-bug-repro/blob/main/metro.config.js |
sorry its been a while, are you still having this issue? |
yep, we've been on 6.5.3 so the same issue exists. We've been patching https://github.com/storybookjs/react-native/blob/next/packages/react-native/src/preview/start.tsx#L56
|
Ok I'll try add that fix today, thanks |
fix released in version 6.5.4 @arthuralee can you try updating and removing the patch? |
sorry, super late reply but it does work 🎉 thanks! |
Describe the bug
During HMR, we get a
Error: Couldn't find story matching '' after HMR
error in the consoleTo Reproduce
Steps to reproduce the behavior:
require("./.ondevice").default;
to App.tsx. This mimics an app setup where Storybook is used as a secondary screen/component rather than the main appExpected behavior
No error
Screenshots
Code snippets
If applicable, add code samples to help explain your problem.
System:
Please paste the results of
npx -p @storybook/cli@next sb info
here.Additional context
This seems to be caused by this line https://github.com/storybookjs/react-native/blob/next/packages/react-native/src/preview/start.tsx#L56 which loads a story with story ID =
''
. Because the storybook UI isn't open in this scenario, the story loading code breaks trying to load a story with id''
. Changing this line toselection: null
seems to solve the problem.The text was updated successfully, but these errors were encountered: