-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
url params don't work for some args (protected names maybe?) #14508
Comments
This is reproducible in Storybook's own DS storybook: https://5ccbc373887ca40020446347-qrbicufmsd.chromatic.com/?path=/story/button--basic&args=children:hello;appearance:outline that should show a button with appearance set to outline (which works correctly) and its children set to "hello", but the children arg here has no effect. |
I'm not quite sure the DS exhibits the same issue per se. Your problem appears to be with TS inference. I'm going to need more info to debug this. Could you run the following in your Storybook (iframe context) and post the resulting JSON? let { args, argTypes } = __STORYBOOK_STORY_STORE__._stories[__STORYBOOK_STORY_STORE__._selection.storyId]
console.log(JSON.stringify({ args, argTypes }, null, 2)) I suspect that the I've confirmed a bug in restoring object string values from the URL. If you set |
@ghengeveld thanks for getting back to me! here's what I get (i truncated the list of all possible name values since it's quite long):
|
Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.6 containing PR #14511 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
the latest version (6.2.7) does not address this. It still does not work. |
looks like I have the same problem. For arg named date: {
control: {
type: 'date',
},
defaultValue: Date.now(),
}, |
I think I have a similar issue since #6133 and #13803 import { useArgs } from '@storybook/api';
const [args, updateArgs, resetArgs] = useArgs();
// To update one or more args:
updateArgs({ children: '<b>test</b>' }); through an addon I made, that was driven by my E2E testing. Now, because it syncs the arg values with the URL and therefore sanitizes them, Can an option be added to turn off this sync args to URL feature? As for this solution Additionally, this now causes a navigate event, which re-renders the whole page and any DOM modifications that I might have done, are gone every time I update the args... |
@antoniosZ can you open a new issue with a repro using |
I have just realised switching from |
Switching to |
Using edit: A caveat discovered here is if you're using |
We’re cleaning house! Storybook has changed a lot since this issue was created and we don’t know if it’s still valid. Please open a new issue referencing this one if:
|
Describe the bug
After reading that storybook supports controlling args through URL parameters [1] [2], I am trying it out, because I had a great use case for linking to a particular set of props for a component from my release notes.
However, it seems that when the prop you want to control is called
name
, or when you want to control thechildren
prop, this method doesn't work.To Reproduce
I have a prop that has a type like this:
I tried a URL param like this:
but it had no effect.
There are, however, other props that do work just fine, and they have similar types. For example I have props like
and passing
does correctly set the color, even though the name prop gets ignored.
This leads me to suspect that it's the name
name
itself that is causing the issue here. adding a newname
prop to other components seems to suggest this is reproducible.I'm also experiencing this with the
children
prop.The text was updated successfully, but these errors were encountered: