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

@storybook/addon-docs: Broken source code with shorthand parameters #10827

Closed
yarastqt opened this issue May 18, 2020 · 4 comments
Closed

@storybook/addon-docs: Broken source code with shorthand parameters #10827

yarastqt opened this issue May 18, 2020 · 4 comments

Comments

@yarastqt
Copy link

Describe the bug
I'm use shorthand syntax for parameters and all my stories don't have source code.

To Reproduce
Steps to reproduce the behavior:

  1. Define parameters in other place, and use shorthand syntax for export default.
  2. Run storybook.
  3. See No code available for all stories.

Expected behavior

Property parameters should be extended, for example:

export default {
  title: 'Controls/Button',
  parameters: Object.assig(parameters, {"storySource":{"source":"...","locationsMap":{}}),
}

Code snippets

Minimal code for reproduce:

import React from 'react'

const parameters = {}

export default {
  title: 'Controls/Button',
  parameters,
}

export const Plain = () => (
  <div style={{ height: 60 }}>
    <button>Hello Button</button>
  </div>
)

Code after processing:

export default {parameters: {"storySource":{"source":"...","locationsMap":{}},},
    title: 'Controls/Button',
    parameters,
}

System:

Dependencies:

"@storybook/addon-docs": "5.3.18",
@yarastqt
Copy link
Author

Also if define title too in other place, then locationsMap will be empty and source code will not available too.

@shilman
Copy link
Member

shilman commented May 19, 2020

That's not currently supported. For now you should declare stuff statically as a workaround.

@stale
Copy link

stale bot commented Jun 9, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jun 9, 2020
@stale
Copy link

stale bot commented Jul 11, 2020

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@stale stale bot closed this as completed Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants