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
Angular source code view unavailable until control toggled #14193
Comments
@yngvebn is this something you can help with? |
I can atleast point in the right direction. As far as I remember, this is broken in the "old" Angular rendering-mechanic, but works if you apply
This should enable the Show Code button immediately, and added benefit is faster rendering of Angular storybooks :) |
Yes, inline fixed the issue for me. Thanks (And made the page size much smaller as i don't have the Angular framework in each iframe) Leaving this open as I assume it needs to be fixed for iframe scenarios? |
@ThibaudAV or @shilman might answer if framed stories are going to be deprecated or not... |
we might make inline the default in the (near) future. as for deprecating iframe stories, i don't see that happening. we'll probably need to fix the bugs eventually, but later as part of a major refactor for addon-docs. |
I'm seeing the same issue on 6.2.1 now. Was not seeing this on previous 6.2.0 release candidates, but just updated to 6.2.1 and noticed it. |
@bmayen any chance you can bisect to find out which specific version introduced the problem? |
If it can help you, i see this problem on version |
I am using |
I have the same problem (angular 11)
On Docs tab of predefined Stories I see "No code available". The "Show code" button is unlocked after clicking on "Reset controls" or after some switching between Stories. The problem is reproducible on versions 6.2.1-6.2.8. And inline mode does not solve the problem. |
Yeah, I see inline mode no longer solves this for me anymore. |
Maybe it was never working correctly. I have been manually setting the source code using parameters.source.code. Doing this makes the source code view available immediately. |
@dexster the difference between your work around and the default behavior for stories that accept args as their input is that the |
Looking at diffs between 6.2.0 rc.7 and rc.10. Perhaps a change introduced here is having an effect on this? |
cc @ThibaudAV ☝️ 🤔 |
@ThibaudAV which PR fixed it in 6.2.8? Also can you elaborate on "quite random"? |
I'm setting inlineStories to For now, I'm pinned to rc.7 since Show Code is a critical feature for us. |
@shilman this PR : #14447 @bmayen In you need to remove this import @shilman "quite random" because I don't seem to understand when it displays and when it doesn't ^^ |
Still happening in 6.3.0-alpha.7. If I get some time I will try assist and see if I can find anything in the source |
I don't know if it's related but I have bump babel to |
@dexster @shilman another way to reproduce this problem ^^
why the 1st time the code is unavailable ? I looked insourceDecorator and the emits are well done. I think the problem comes later 🤔 |
Hope this helps: I added a log entry in sourceDecorator.ts for when the sourceDecorator method emits SNIPPET_RENDERED with the source code data. In 6.2-rc.7 on initial page load it emits SNIPPET_RENDERED first then the events for setting and rendering docs happen. Note the "manager received docsRendered" In later versions (6.3-alpha5 for this test) on initial page load, you can see in the second screenshot that all the events including "manager received docsRendered" happen before SNIPPET_RENDERED is emitted. In the last screenshot you can see that after toggling to the canvas tab and back to docs the order is correct. SNIPPET_RENDERED is called first and then docsRendered and other events happen after that |
@dexster thanks for this detective work. just to confirm a bit:
Thanks! 🙏 |
inlineStories is true when I tested above with those logs. When I initially created this issue I was using iframes but I have moved to inline and it still happens |
Beat me to the comment @dexster :) |
show source with inlineStories are also not working for me |
Odd behavior - if you run storybook and have Safari as your default browser and it automatically opens on the first load of Storybook only, it WILL show "Show Code" but if you open another browser or browser window or even refresh that same page that had previously worked, it won't show "Show Code" until you toggle or click something else on the page. |
With v6.3 now in beta, could this get a bump in priority? Would love to upgrade and test newer releases, but this is a blocker for us and is keeping us pinned to 6.2.0-rc.7. We have multiple teams, both internal and external contractors, using Storybook daily to reference canonical code samples and we can't tell them all to use this hack every time they view it. |
This is still a problem in storybook 6.3. Currently I reverted to 6.1 and not upgrading until fixed. |
this is still a major blocker |
After a clean install of latest storybook 6.3, the source code is showing up but not completely. See #15575 |
I'm experiencing this issue. This makes using inline components not an option for us 😞 |
But that's not an issue with StoryBook. That's your component working as expected 😄 You could wrap that story with a container that meets the requirements to "contain" the header. Personally, I've just let my header stories show the components at the top of the page. |
Yes, you're totally right, it's the expected behaviour. But it's a shame it's not showing the code example with iframed components. |
@lucas-labs, are you saying that the bug described in this issue by the OP is only a problem for you with iframes and not with inline? Because we've been seeing it with inline as well. What version are you on? |
@bmayen, yes exactly, it's working ok for me with inline components. I'm on v6.3.8 |
I upgraded to v6.3.9 and am having the "No code available" bug, but in a slightly different way. On initial load of the docs I see the code. Navigate to another set of stories, come back to the original set of stories, and now I see "No code available". Getting the "Show code" back can be done by loading another story in the set or clicking the reload button on the args table. I have tried with
and
|
@joshuahunt10, I upgraded to 6.3.12 and am seeing the same behavior. Also described here #16003. |
I believe this has been fixed in 6.4-beta. To upgrade:
Closing this for now. Please let me know if it needs to be reopened! |
Needed due to the following issue in storybook with 'show code' snippet: storybookjs/storybook#14193
Seems to appear again at least since 6.4.12+ |
Describe the bug
In the Docs tab the "Show code" option is disabled and shows "No code available". Simply clicking a control enables the ability to Show code
To Reproduce
Steps to reproduce the behavior:
npx sb@next init
in the projectnpm run storybook
Expected behavior
Show code should be immediately available when page loads
Screenshots
Disabled on load
Enabled after clicking primary
System
System:
OS: macOS 11.2.2
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 14.15.5 - ~/.nvm/versions/node/v14.15.5/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.5/bin/yarn
npm: 6.14.11 - ~/.nvm/versions/node/v14.15.5/bin/npm
Browsers:
Chrome: 89.0.4389.82
Edge: 88.0.705.81
Firefox: 86.0
Safari: 14.0.3
npmPackages:
@storybook/addon-actions: ^6.2.0-beta.12 => 6.2.0-beta.12
@storybook/addon-essentials: ^6.2.0-beta.12 => 6.2.0-beta.12
@storybook/addon-links: ^6.2.0-beta.12 => 6.2.0-beta.12
@storybook/angular: ^6.2.0-beta.12 => 6.2.0-beta.12
┆Issue is synchronized with this Asana task by Unito
The text was updated successfully, but these errors were encountered: