-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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]: Adding arguments in the decorator breaks the source code #22127
Comments
Hmm, yes I see. Do you have another suggestion about how we can associate emitted source to story when the same story is rendered > 1 times in docs (apart from using the args?). Right now we either render: (It isn't possible--by design--to have >1 version of the "current args" for single story). So we might consider doing something less general here and rather than keying on the used args, just keying on initial vs current, and storing (up to) two source values per story. WDYT? |
Could we do something where we modify the source snippet payload to be like
WDYT? |
To do that the decorator would need to know the order of the story. Which would mean the Story block would have to pass that order through the story context somehow. Seems possible but probably pretty involved. Then again passing the initial vs non initial thing might require a similar manoeuvre. Hrmm |
If you add the decorator to a specific story and not to the meta, nothing will change. {
args: {
primary: true,
label: 'Button'
},
decorators: [withCustomProp]
} I don't know if this information will be helpful. |
Thanks @Jekins. I understand the issue pretty well, just trying to figure out the best solution :) |
Also linked to #21456 if it helps gathering informations 👍 . |
@tmeasday Now everything works. Thank you! |
Describe the bug
If we add additional arguments to
context.args
in the decorator, then in the source code in Docs, not the code of the component, but the source code of the story as an object is displayed.To Reproduce
Button.stories.ts
If we click on Show code in Docs, we see:
https://stackblitz.com/edit/github-qrhck4?file=src/stories/Button.stories.ts
System
Additional context
No response
The text was updated successfully, but these errors were encountered: