-
-
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
[Bug]: Storybook doesn't recover after fixing syntax error in stories file #24155
Comments
I have the same experience! |
I just tried reproducing on a fresh Vite project and did not encounter this issue. Do you a have a reproduction repo you can share? If not, can you create one? Go to https://storybook.new or see repro docs. Thank you! 🙏 |
I take that back. I am able to reproduce the problem intermittently. When I create a syntax error I get the error screen, and when I fix the syntax error the story renders correctly. However, the sidebar stories sometimes disappear. When I edit the |
Glad you were able to reproduce it. We're using the webpack builder, if it makes a difference in reproducability. |
I encounter a similar issue when when switching between branches. Being on a feature branch I start storybook, everything works. And then I've to restart it which takes ~1 min on my codebase. Would it be possible for the watcher to handle removed files too? as well as errors |
@shilman Might be a dumb suggestion, but could a band aid be to show a button on the error screen when storybook can't index a file, to trigger a new scan of all the files? Of course it's not a proper fix, but given that meanwhile we've to manually restart storybook… it could still be a huge win. |
Update: if I make any change in the story's .mdx file after the crash, then storybook recovers. |
@shilman I think I am having same problem here. It breaks down as I am working on my stories and by updating stories it does not restore. I have to do some random change in mdx file for it to recover. I am currently migrating big ui library to storybook and it happens every couple of minutes and its making the process quite painful. Latest storybook 7.5.3, with vite and vue3. I can try to create minimal reproducible setup, but since you mentioned that you can reproduce it I not sure if its worth the time. |
@shilman I have the same issue. When I edit my stories, if any syntax error occurs and then fixed, then the storybook always turns as
If I edit anything in my tree.mdx, then it recovers. Otherwise, I will have to restart the storybook. My repo uses rollup.js to compile my component library. Recently, I upgraded Storybook 6.5 to the latest Storybook 7 for more advanced MDX feature support. I am wondering if any legacy mdx setting of my repo might cause this issue. Here's my pacakage.json in 6.5 I am still using addon-docs which is included in 6.5. Everything seems work so I haven't change to as documentation recommended package '@storybook/blocks'
Also, I manually set the mdx version when I am using Storybook 6.5 by following resolution in #18094; I am wondering if upgrading the package will get me rid of the errors.
Really appreciate for your help! |
Now this has seemingly started happening even when I'm not making a syntax error, just "normally" editing the code. So I sometimes have to edit-save-edit-save the .mdx file after each story change... It could be caused by editor auto-save happening in the middle of editing, but not sure. |
Also having the same problem |
Same problem, Angular 17 with storybook 7, but not related to mdx file change |
The same problem, when editing .mdx file (v. 7.0.2) |
If you try upgrading to the latest release does that fix it?
|
Still an issue for me after upgrade. Like emlai mentioned above, re-saving the corresponding .mdx fixes it but I don't think anyone would know to do that instinctively. |
Describe the bug
When making a syntax error in a .stories.tsx file, storybook crashes with the following error:
After fixing the syntax error, storybook is unable to recover and shows a new error:
The only solution is to restart storybook.
Some issues I observe:
WARN
andNo errors found.
, but seems like this should be an error, not a warning?Invariant failed
shouldn't happen. Storybook should only report the syntax error e.g.Unexpected token, expected ","
Invariant failed
shouldn't also happen. Storybook should recover and render without errors.To Reproduce
Create a storybook with an mdx file that imports a .stories.ts file, and make a syntax error in the stories file.
System
Additional context
No response
The text was updated successfully, but these errors were encountered: