-
-
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
Stories disappear after HMR #7493
Comments
@city41 Sounds pretty weird. I just tested it out in a simple project and wasn't able to reproduce. I did find a corner case bug in the process #7497, but don't think it's related to what you're seeing. Are there any patterns to which stories are disappearing? Are entire files not loading, or are some stories from files partially loading and others not loading? Here's what I'd suggest:
Thanks!! |
I am going to dig into this today and see if I can contribute anything helpful. |
From what I can tell, this issue was introduced in I didn't try every single release :) I binary searched to find 37. I'll keep digging into 37's changes and see if I can find a culprit. |
I tried rolling back that change and still saw the issue, but I'm not 100% certain on that. Just now I copied alpha.36's client-api/dist into alpha.37's and the problem went away, so does feel like the problem is somewhere in there (client-api is primarily what changed from 36->37) |
I take that back. It does feel like that change might be the culprit @shilman . Here is what I did
|
@city41 I'm releasing |
Do you mean Here is my config.js
As far as I know, I am only calling load once. I will try beta.6 once it's out. Thanks for looking into this! |
Hmm, ok there goes that theory then! 🤷♂
Thanks so much for hunting down the breaking change and also for being so patient on this. Promise this is going to be amazing once the kinks are worked out 😸 |
The eagle has landed: https://github.com/storybookjs/storybook/releases/tag/v5.2.0-beta.6 |
The bug still repros for me with beta.6 |
Although interestingly, with beta6 it doesn't always repro. Sometimes I make a change and it succeeds to reload the stories. In alpha 37 on up, as far as I know, the bug always repros after a change. |
@city41 Rats. I'll dig in on this and see if I can get a repro today. |
I will debug a bit more tomorrow as well. I'll also see if I can get a repro, I suspect at the very worst I could replace all my real code with dummy code but keep the story structure, and stick that on github somewhere 🤞 |
Here are some thoughts:
I tried to repro in the monorepo but haven't had any luck yet. If you can create a repro I'm sure I can get to the bottom of this. |
I'll give your debug tips a try this afternoon. In the mean time, I did create a pretty small repro: https://github.com/city41/storybookRepro I took my actual project and stripped out most everything. There's a lot of cruft in the package.jsons for example. But for the most part just a few stories and a few dummy components feeding them. With this repo I can reproduce the bug. |
@city41 awesome. I'll take a look today. Thanks so much for doing this! |
OK figured out the problem based on your repo and am working on a fix. The issue is that you have three files that contain the following snippet Due to a bug we "accidentally" supported duplicating titles in early alphas (at the cost of other things, like not being able to delete stories from a kind). I think the fix is:
What do you think? |
Ah, I see. Thanks for tracking this down. I am pretty new to storybook and didn't realize that is a limitation. The reason I did that as it removes one layer of nesting from the stories. I can have a tree like this Otherwise it needs to be something like this I understand that most of the time, a component will have more than one story, so in the general case it does make sense. Thanks for all your help! Sorry it was just user error at the end. |
No worries! It's possible to do what you were trying to do with the "classic" Here's how I would hack it in MDX if I wanted your flatter structure FWIW:
|
Maybe I'll go back to the old API. The problem with putting more than one story in an MDX file is it muddies the doc tab. My goal is for each button to have its own doc tab. Since the old API still supports MDX docs, maybe that is a better fit for me? |
@city41 The The right way to do this unless you really want to fight against Storybook is that each component gets its own MDX file. We have UI updates planned that will partially address your nesting concerns, which are partially described in #6646 and #6644 Specifically, when you're running in dev mode, the extra nesting will be there, but we'll save you one click since clicking on the component will navigate to the first story. When you static export your stories using the Both of these changes are still tentative, but will be fixed before 5.2 ships. In the future we may also allow addons to mess with the nav hierarchy, so that's a backdoor to do even more customization. Hope that helps. |
ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.0-beta.8 containing PR #7542 that references this issue. Upgrade today to try it out! You can find this prerelease on the Closing this issue. Please re-open if you think there's still more to do. |
Describe the bug
While Storybook is running, after making a change to source and saving, webpack rebuilds and HMR updates the browser. But when this happens, many of the stories disappear.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All the stories to remain, and the new code changes to be present.
Actual behavior: most stories disappear
Screenshots
Starting state:
After performing the above steps:
System:
Additional context
I have been using the 5.2.0 alphas (and now betas) to try out the docs features. My stories are written in MDX. I did not notice this happening when I was using the alphas, but it does occur for me with both 5.2.0-beta.0 and 5.2.0-beta.3
The only error I see in the browser console is
vendors~main.44efb48ad30cf85163a3.bundle.js:585 The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type".
which doesn't seem relevant.In the terminal, I see no errors. I do get warnings like this
These warnings are all for TypeScript interfaces. On the surface they seem unrelated (I've always gotten these warnings)
If I refresh the browser, the stories all return to normal.
The text was updated successfully, but these errors were encountered: