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

[Bug] Render error when mdx have multiple stories have different component id #1

Open
divinespear opened this issue Jun 20, 2023 · 0 comments · May be fixed by #2
Open

[Bug] Render error when mdx have multiple stories have different component id #1

divinespear opened this issue Jun 20, 2023 · 0 comments · May be fixed by #2
Labels
bug Something isn't working

Comments

@divinespear
Copy link

divinespear commented Jun 20, 2023

Describe the bug

Error thrown while rendering stories (<Canvas>, <Primary>, <Story>) when mdx have multiple story component (have different component id).
Only last story rendered correctly.

Error: Cannot read properties of undefined (reading 'rendered')
  at updatePath (/node_modules/.cache/sb-vite/deps/chunk-FDCUOOAW.js?v=8e1e7aca:221:7))
  at /node_modules/.cache/sb-vite/deps/chunk-FDCUOOAW.js?v=8e1e7aca:253:77
  at runUpdates (/node_modules/.cache/sb-vite/deps/chunk-TDGLCOIR.js?v=8e1e7aca:879:17))
  at batch (/node_modules/.cache/sb-vite/deps/chunk-TDGLCOIR.js?v=8e1e7aca:453:10))
  at setStore (/node_modules/.cache/sb-vite/deps/chunk-FDCUOOAW.js?v=8e1e7aca:252:5))
  at renderSolidApp (/node_modules/.cache/sb-vite/deps/storybook-solidjs_preview.js?v=8e1e7aca:107:3))
  at StoryRender.renderToCanvas [as renderToScreen] (/node_modules/.cache/sb-vite/deps/storybook-solidjs_preview.js?v=8e1e7aca:144:23))
  at async (/sb-preview/runtime.js:74:10839)
  at async StoryRender.runPhase (/sb-preview/runtime.js:74:8766))

Steps to reproduce the behavior

Follow https://storybook.js.org/docs/react/writing-docs/mdx#working-with-multiple-components

  1. Create multiple story sources
  2. Create mdx file and import stories
  3. Add <Canvas> and/or <Story> for imported stories.
  4. PROFIT!

Expected behavior

Should render every <Canvas>, <Primary>, and/or <Story> correctly even if story id is different.

Screenshots and/or logs

Error screenshot:
Error screenshot

Source I wrote:
Source screenshot

Environment

  • OS: Linux - Host: Ubuntu 22.04.2 LTS (jammy) / Docker: Debian GNU/Linux 11 (bullseye)
  • Node.js version: v18.16.0
  • NPM version: pnpm 8.6.2
  • Browser (if applicable): Chrome
  • Browser version (if applicable): 114.0.5735.133
  • Device (if applicable):

Additional context

After some inspection, I found render.tsx allows only one story id per doc...

Current workaround is put every stories into single story file even if story is for different component. (and side navbar will be hell :D)

@divinespear divinespear added the bug Something isn't working label Jun 20, 2023
@divinespear divinespear changed the title [Bug] Render error when mdx has multiple component stories [Bug] Render error when mdx have multiple stories have different story id Jun 20, 2023
@divinespear divinespear changed the title [Bug] Render error when mdx have multiple stories have different story id [Bug] Render error when mdx have multiple stories have different component id Jun 21, 2023
@divinespear divinespear linked a pull request Jun 21, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant