-
-
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
MDX Angular stories get re-instantiated within the same docs tab by navigating back and forth #18176
Comments
We found another problem with angular stories in docs: They seem to be instantiated multiple times for one docs load (seven times in our case). This makes the initial load very slow, in addition to the re-render on navigation clicks. To me it seems like the code in
|
this code here also looks like it could cause problems storybook/app/angular/src/client/preview/angular-beta/DocsRenderer.ts Lines 16 to 37 in 8da2f7f
but even If I remove that, the story contents are still constantly being cleared, even within this
That's also what is causing these errors for us
I think I'll stop here :D but maybe these findings help |
I found out that this seems to be fixed using
However, since this is not stable yet, other bugs are popping up. As soon as you switch between 2 docs stories, all Angular components just break and Storybook renders nothing Probably a good idea to fix the new InlineRenderer instead of optimizing the old one? 🤔 |
@kroeder I definitely think we should focus on the new inline render, we aren't sure if we will even keep the old one in 7.0. |
Hey @sir-captainmorgan21 in SB7 we are only using the new inline renderer, and there have been many improvements. I'd suggest trying that out when you can! |
I haven't kept up with the SB7 docs changes, but will this issue's scenario still be something that can happen in SB7? Unless it can still be configured to have a Canvas and Docs tab, clicking a story will always go to that story's Canvas page now, right? |
I guess not @Marklb. Certainly not as easily. You could create two different docs pages that contain the same set of stories and click between them I suppose. |
@tmeasday ok awesome. Will try that out. With SB7 Im assuming you no longer have to configure inlineStories: true in the preview.js anymore? Seems so since the inline renderer is the only one being used now. Also, I think this may be related to and resolve this issue: #14026 Do you mind confirming? I know it would help a whole lot of folks who are working around it by just turning off inlineStories |
Yes, I think so based on this example from one of our sandboxes (no special parameters/settings): https://6377871ac35b4b579c6b8bfc-fbuoibhfqz.chromatic.com/?path=/docs/addons-docs-docs2-button--docs |
If I understand what you are saying, then that would be a different scenario that I would think should rerender. Depending on the extent of this issue, maybe it would still apply. I always thought of clicking a Story from the sidenav or the links addon as opening a new docs page that happens to be the same content as the other stories in the file. If that is what is actually happening then I figured this issue would change it to be able to recognize the same docs page is being navigated to and scroll to the story instead. I forgot stories could be defined in an @tmeasday When you say "in SB7 we are only using the new inline renderer", do you mean your team is only using it or it is the only one that will be usable? I assume you mean your team is only using it, but the option of using an iframe will still be available. The inline option is preferred for most of my library components, but in an application that has more larger "page-like" components I prefer the isolation of an iframe. I also tried some that use CSS media queries and they did not look right when resized into a container element. |
@Marklb I think you probably have that right I'm not 100% clear on the circumstances that led to the original error here.
I think there's some ambiguity here, there are two things that are involved:
|
Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.14 containing PR #20118 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Describe the bug
If you have a structure like this
I would expect that after clicking Story A or B the docs tab gets rendered only once.
The actual behaviour is that if you enter Story A and then Story B all of the Angular instances get destroyed and re-bootstrapped which is fine for smaller components but for complex / data-intensive stories, this is a major performance impact.
I don't know how other framework implementations handle this but I would expect navigating inside the same rendered content should do nothing.
To Reproduce
example/angular-cli
in the monorepoawait getPlatform().bootstrapModule
inapp/angular/src/client/preview/angular-beta/AbstractRenderer.ts
System
Additional context
I believe the described behaviour above is the correct behaviour for the Canvas-Tab.
The render function needs to know if the navigation was triggered while being in the docs tab and then do nothing instead of destorying / bootstrapping everything
The text was updated successfully, but these errors were encountered: