storybookjs / solidjs

SolidJS integration for Storybook, maintained by the community
MIT License
44 stars 2 forks source link

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

Open divinespear opened 1 year ago

divinespear commented 1 year ago

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

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)