solidjs icon indicating copy to clipboard operation
solidjs copied to clipboard

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

Open divinespear opened this issue 1 year ago • 0 comments

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 avatar Jun 20 '23 15:06 divinespear