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]: Elvis (?) is breaking autodocs and 'show source' for Svelte components #24008

Closed
silkroadnomad opened this issue Aug 30, 2023 · 1 comment · Fixed by #24096
Closed

Comments

@silkroadnomad
Copy link

silkroadnomad commented Aug 30, 2023

Describe the bug

Under a number of circumstances when an Elvis (?) operator is being used, the "autodocs" function stops working and the jsdoc description does not appear inside the storybook properties documentation. Also, the 'show source' function starts delivering incorrect and confusing code.

image

To Reproduce

I used the Button example of a new Svelte based Storybook installation for simplicity:
See line 14 as an example:

https://stackblitz.com/edit/github-tqvcar?file=src%2Fstories%2FButton.svelte

Furthermore, I realized that "?"- operators inside the Svelte components HTML / Svelte code, lead to the same situation.

Also the description must be before the @type jsdoc command and not after. Otherwise, it does not appear.

System

Environment Info:

  System:
    OS: macOS 13.4.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 18.4.0 - ~/.nvm/versions/node/v18.4.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.12.1 - ~/.nvm/versions/node/v18.4.0/bin/npm
  Browsers:
    Chrome: 116.0.5845.110
    Safari: 16.5.2
  npmPackages:
    @storybook/addon-essentials: ^7.4.0 => 7.4.0 
    @storybook/addon-interactions: ^7.4.0 => 7.4.0 
    @storybook/addon-links: ^7.4.0 => 7.4.0 
    @storybook/blocks: ^7.4.0 => 7.4.0 
    @storybook/jest: ^0.2.1 => 0.2.2 
    @storybook/svelte: ^7.4.0 => 7.4.0 
    @storybook/sveltekit: ^7.4.0 => 7.4.0 
    @storybook/test-runner: ^0.13.0 => 0.13.0 
    @storybook/testing-library: ^0.2.0 => 0.2.0

Additional context

@j3rem1e
Copy link
Contributor

j3rem1e commented Sep 1, 2023

This is caused by alexprey/sveltedoc-parser#87

sveltedoc-parser fails to parse the component. The documentation is not injected into the source, and we use this documentation to lookup the name of the component. If the documentation is not present, then we call 'component.name'. In the case of the example here, 'component.name' links to the Proxy HMR from vite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants