storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
103 stars 32 forks source link

[Bug]: `v5` - using `tags` for individual stories causes error #200

Closed bhvngt closed 1 month ago

bhvngt commented 1 month ago

Describe the bug

When v5 of this addon is used, using tags for individual stories causes crash.

Steps to reproduce the behavior

Here's the reproduction of this issue.

Note: For some unknown reason, stackblitz does not save .storybook folder. Hence, storybook init will have to be run to render storybook

Make following changes to src/stories/Button.stories.svelte file

<Story name="Secondary" tags={["!dev"]}/>

Expected behavior

Expecting Secondary story to disappear from storybook sidebar.

Screenshots and/or logs

image

xeho91 commented 1 month ago

Hey @bhvngt, thank you for testing out v5 ❤️ and spotting this bug! I confirm I was able to reproduce the issue.

@JReinhold You could extract more info from the console in web browser dev tools.

I handpicked a few:

13:28:28.957 runtime.js:8446 

       GET https://sveltejskittemplatedefaultbxes-hfev--6006--60a75bde.local-credentialless.webcontainer.io/index.json 500 (Internal Server Error)
getStoryIndexFromServer @ runtime.js:8446
initializeWithProjectAnnotations @ runtime.js:8432
initialize @ runtime.js:8406
await in initialize
PreviewWithSelection @ runtime.js:8934
PreviewWeb @ runtime.js:9365
(anonymous) @ vite-app.js:23
13:28:28.957 runtime.js:4708 Error loading story index:
error @ runtime.js:4708
renderPreviewEntryError @ runtime.js:8615
renderPreviewEntryError @ runtime.js:9118
initializeWithProjectAnnotations @ runtime.js:8435
await in initializeWithProjectAnnotations
initialize @ runtime.js:8406
await in initialize
PreviewWithSelection @ runtime.js:8934
PreviewWeb @ runtime.js:9365
(anonymous) @ vite-app.js:23
13:28:28.957 runtime.js:4708 SB_PREVIEW_API_0006 (StoryIndexFetchError): Error fetching `/index.json`:

TypeError: Cannot read properties of undefined (reading 'type')

If you are in development, this likely indicates a problem with your Storybook process,
check the terminal for errors.

If you are in a deployed Storybook, there may have been an issue deploying the full Storybook
build.
    at ts.getStoryIndexFromServer (https://sveltejskittemplatedefaultbxes-hfev--6006--60a75bde.local-credentialless.webcontainer.io/sb-preview/runtime.js:8449:11)
    at async ts.initializeWithProjectAnnotations (https://sveltejskittemplatedefaultbxes-hfev--6006--60a75bde.local-credentialless.webcontainer.io/sb-preview/runtime.js:8432:15)
    at async ts.initialize (https://sveltejskittemplatedefaultbxes-hfev--6006--60a75bde.local-credentialless.webcontainer.io/sb-preview/runtime.js:8406:39)
error @ runtime.js:4708
renderPreviewEntryError @ runtime.js:8615
renderPreviewEntryError @ runtime.js:9118
initializeWithProjectAnnotations @ runtime.js:8435
await in initializeWithProjectAnnotations
initialize @ runtime.js:8406
await in initialize
PreviewWithSelection @ runtime.js:8934
PreviewWeb @ runtime.js:9365
(anonymous) @ vite-app.js:23
13:28:28.959 runtime.js:8446 Fetch failed loading: GET "https://sveltejskittemplatedefaultbxes-hfev--6006--60a75bde.local-credentialless.webcontainer.io/index.json".
getStoryIndexFromServer @ runtime.js:8446
initializeWithProjectAnnotations @ runtime.js:8432
initialize @ runtime.js:8406
await in initialize
PreviewWithSelection @ runtime.js:8934
PreviewWeb @ runtime.js:9365
(anonymous) @ vite-app.js:23

Is it possible that it could be an upstream issue in @storybook/preview-api?

JReinhold commented 1 month ago

I'm looking into this.

bhvngt commented 1 month ago

Thanks @JReinhold