-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Controls: Reset button broken for !undefined
URL values
#18143
Comments
I had a look at this and if I understood it correctly See:
If you pass I'm not 100% sure I understand the use case correctly but to me, it looks like the Could the prefix be more complex? what about something like: const INTERNAL_ONLY_ARGS_VALUE_PREFIX = 'INTERNAL_ONLY_ARGS_VALUE_PREFIX';
if (type === 'value' && str.startsWith(INTERNAL_ONLY_ARGS_VALUE_PREFIX)) {
if (str === `${INTERNAL_ONLY_ARGS_VALUE_PREFIX}undefined`) return undefined;
if (str === `${INTERNAL_ONLY_ARGS_VALUE_PREFIX}null`) return null;
} Please let me know if I misunderstood something or if there is a better way to solve this 🙂 |
https://storybook.js.org/docs/react/writing-stories/args#setting-args-through-the-url It looks like I opened PR #18231 which fixes the issue by resetting all args to their initial value. Please let me know if this is a suitable fix! 🙂 |
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-rc.1 containing PR #18231 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
When you set the value to an arg as
!undefined
in the URL, e.g. by following the reproduction steps in #18135, then hit the "reset" button in the controls UI, you would expect the story to return to its original state (equivalent of deletingargs=xxx
from the URL). However it retains the!undefined
value.The text was updated successfully, but these errors were encountered: