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

Copy knob state URL looses value type #1

Open
Silic0nS0ldier opened this issue Apr 28, 2021 · 4 comments · May be fixed by #38
Open

Copy knob state URL looses value type #1

Silic0nS0ldier opened this issue Apr 28, 2021 · 4 comments · May be fixed by #38
Labels
bug Something isn't working

Comments

@Silic0nS0ldier
Copy link
Contributor

Describe the bug
The knobs addon supports copying a URL with existing knob states. Some knobs may use a number as the value, however they are casted to a string when restoring knob state using the copied URL.

To Reproduce
https://github.com/Silic0nS0ldier/storybook-knobs-copy-bug

System

System:
  OS: macOS 10.15.7
  CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
  Node: 12.22.1 - /usr/local/opt/node@12/bin/node
  Yarn: 1.22.10 - /usr/local/bin/yarn
  npm: 6.14.12 - /usr/local/opt/node@12/bin/npm
Browsers:
  Chrome: 90.0.4430.85
  Edge: 90.0.818.49
  Safari: 14.1
npmPackages:
  @storybook/addon-a11y: ^6.1.21 => 6.1.21 
  @storybook/addon-actions: ^6.1.21 => 6.1.21 
  @storybook/addon-knobs: ^6.1.21 => 6.1.21 
  @storybook/addon-viewport: ^6.1.21 => 6.1.21 
  @storybook/addons: ^6.1.21 => 6.1.21 
  @storybook/react: ^6.1.21 => 6.1.21

Additional context
NA

@shilman
Copy link
Member

shilman commented Apr 28, 2021

FYI, we’ve released addon-controls in Storybook 6.0. Controls are portable, auto-generated knobs that are intended to replace addon-knobs, which are slated for deprecation.

Please upgrade and try out controls today!

@Silic0nS0ldier
Copy link
Contributor Author

Appreciate the heads up. addon-controls and addon-knobs presumably play together fine right? (for context, there are 1110 and growing stories using @storybook/addon-knobs in the repo where this issue was identified, making incremental adoption a must)

@shilman
Copy link
Member

shilman commented Apr 29, 2021

@Silic0nS0ldier Yes, they can exist side by side, possibly even in the same story/component. But I'd probably convert them file by file, i.e. when you touch a component's stories, convert them all into controls in one shot.

@shilman shilman transferred this issue from storybookjs/storybook May 10, 2021
@mctrafik
Copy link

I'll take a stab at fixing this.

@shilman shilman added the bug Something isn't working label Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants