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]: accidentally ending a title with a / breaks storybook #26642

Open
cellog opened this issue Mar 25, 2024 · 2 comments · May be fixed by #26729 or #26911
Open

[Bug]: accidentally ending a title with a / breaks storybook #26642

cellog opened this issue Mar 25, 2024 · 2 comments · May be fixed by #26729 or #26911

Comments

@cellog
Copy link

cellog commented Mar 25, 2024

Describe the bug

with a title like:

  title: "scenes/MessageComposition/shared/ComposerImageLibraryPanel/",

Storybook fails to compile

To Reproduce

create a story with this title:

  title: "scenes/MessageComposition/shared/ComposerImageLibraryPanel/",

System

Storybook Environment Info:

  System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.11.1/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm <----- active
  Browsers:
    Chrome: 123.0.6312.58
    Safari: 17.4

Additional context

image

@hmcostaa
Copy link

@vanessayuenn I would like to take this issue. I just have some doubts about what is the optimal solution in this scenario. Do we allow the creation of the story by checking if there is nothing after the "/" or we contain the error to that story and allow the rest of the stories to be rendered?

@shilman
Copy link
Member

shilman commented Apr 1, 2024

@hmcostaa The current behavior is mostly correct. Having a / at the end of the title property is not valid CSF, and will break indexing. However, if you click on the error the message that it shows is hard to parse.

image

Full text:

Error: Invalid part '', leading to id === parentId ('example-button'), inside title 'Example/Button/'

I think it should show a more useful error like:

Invalid title Example/Button/ ending in slash.

I could imagine a different UI that shows the rest of the stories and ALSO surfaces the story errors. But that's a much bigger change.

hmcostaa added a commit to hmcostaa/storybook that referenced this issue Apr 3, 2024
…render all components in story that were correctly created.

Instead of displaying the message: "Invalid part '${name}', leading to id === parentId ('${id}'), inside title '${title}'", now we have a better message that clarifys the error and then all other components created correctly will be displayed along side the error message
@sossost sossost linked a pull request Apr 22, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment