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] titlePrefix in advanced story specifiers causes the story to crash with "Didn't find 'xyz' in CSF file" #130

Closed
JReinhold opened this issue Aug 29, 2023 · 3 comments · Fixed by #136
Labels
bug Something isn't working released This issue/pull request has been released.

Comments

@JReinhold
Copy link
Collaborator

Describe the bug

Originally discussed at #120.

If a stories specifier uses the advanced pattern with a title prefix like this:

const config = {
  stories: [
    {
      directory: '../src',
      titlePrefix: 'Custom', // 👈 Configure the title prefix
    },
  ],
};

The story will fail to render with "Didn't find 'some-story-id' in CSF file", if it's been written using Svelte CSF.

This happens because the indexer in this addon ignores that title prefix when generating story IDs, but the Storybook CSF processing in the browser does not ignore that title prefix, so the ID it is looking for will not match the IDs in the index.

Steps to reproduce the behavior

Reproduction: https://github.com/mcmxcdev/storybookjs-addon-svelte-csf-120

Screenshots and/or logs

image

Additional context

This bug can probably be fixed by using the makeTitle function that is passed in the indexer options (second parameter) to the indexer function. That function can be used to generate titles automatically, also taking into account any user title specified.

Using makeTitle to fix this bug will likely also solve #129 .

@j3rem1e
Copy link
Contributor

j3rem1e commented Sep 1, 2023

Should be fixed with #134

@mcmxcdev
Copy link

mcmxcdev commented Sep 1, 2023

Should be fixed with #134

That would be amazing, I have already cloned the project and was thinking of fixing it myself! 🎉

@j3rem1e j3rem1e mentioned this issue Sep 2, 2023
@shilman
Copy link
Member

shilman commented Sep 2, 2023

🚀 Issue was released in v4.0.2 🚀

@shilman shilman added the released This issue/pull request has been released. label Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants