Skip to content

Copy knob state URL looses value type #1

Open

Description

@Silic0nS0ldier

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

Activity

  1. shilman commented on Apr 28, 2021

    @shilman
    Contributor

    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!

  2. Silic0nS0ldier commented on Apr 29, 2021

    @Silic0nS0ldier
    ContributorAuthor

    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)

  3. shilman commented on Apr 29, 2021

    @shilman
    Contributor

    @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.

  4. mctrafik commented on Sep 11, 2021

    @mctrafik

    I'll take a stab at fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions