Skip to content
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

MDXv2: non-Story Canvas content shows "no code available" #18342

Closed
vgpena opened this issue May 26, 2022 · 3 comments
Closed

MDXv2: non-Story Canvas content shows "no code available" #18342

vgpena opened this issue May 26, 2022 · 3 comments

Comments

@vgpena
Copy link

vgpena commented May 26, 2022

Describe the bug
With MDXv2 turned on, if I create a docs page in MDX and add a <Canvas> to that page that doesn't contain <Story> content, the "Show code" button on that <Canvas> says "No code available".

Related to #17514

To Reproduce
Code: https://github.com/vgpena/sb-mdx (see stories/Test.stories.mdx)
Hosted copy: https://vgpena.github.io/sb-mdx/?path=/story/test--page

System
Environment Info:

System:
OS: macOS 12.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.18 - ~/.yarn/bin/yarn
npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
Browsers:
Chrome: 102.0.5005.61
Safari: 15.2

Additional context
<Canvas> blocks that include <Story> content continue to have the "Show code" button as expected.

@zhyd1997
Copy link
Contributor

Submitted a PR here: storybookjs/mdx2-csf#16

@shilman
Copy link
Member

shilman commented Nov 7, 2022

Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-alpha.48 containing PR #19766 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Nov 7, 2022
@shilman shilman moved this to Done in MDX2 Nov 7, 2022
@wdavidw
Copy link

wdavidw commented Jan 1, 2023

I have tried versions ^7.0.0-beta.19 and the issue is still present. For example, the code

<Canvas>
  <button
    className={clsx(
      "block bg-cyan-500",
      "focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",
      "rounded-full w-5 h-5",
    )}
  />
</Canvas>

Yields to

image

By the way, also notice the fixed height in Firefox mentionned in #13814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants