Storybook: Have addon knobs url parameters been removed in v4?

Created on 9 Oct 2018  路  13Comments  路  Source: storybookjs/storybook

Support request summary

I don't know if it is a bug or a wanted feature, but in version 4 knobs are not anymore part of the url parameters. How would it be possible to retain a changed prop? Now props are always reset to default. Issue is related to #3736.

Is it a bug or should I switch to version 3 if I want knobs as url parameters? Thanks!

knobs question / support

Most helpful comment

@Eelsie do you have a repro? you can see the knobs in action on the storybook example:

  1. Navigate to the example
  2. Open the knobs addon, and set Fruit to Banana
  3. Click on the Copy button in the lower right corner.
  4. It will copy a link to the story with Banana
  5. Open that link in another tab. Initially it should say Apple, but after a second it should update to Banana

All 13 comments

The knobs can still be set by URL parameter but changing knobs does not change the URL as it did previously.

Great! Thank you! Old url paramenters don't work anymore though.. how could I build them? With storybook 3 I had for example &knob-fixed=%20true. All the url https://mydomain/?selectedKind=components&selectedStory=logo&knob-fixed=%20true.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@Eelsie do you have a repro? you can see the knobs in action on the storybook example:

  1. Navigate to the example
  2. Open the knobs addon, and set Fruit to Banana
  3. Click on the Copy button in the lower right corner.
  4. It will copy a link to the story with Banana
  5. Open that link in another tab. Initially it should say Apple, but after a second it should update to Banana

Great @shilman! Thank you! This is a great help!

This does not working on dev server with hot reload :-(

@nicgirault which part?

(sorry for the delay)

I start the dev server
I navigate to un story
I choose an option in a knob select list
I click on the copy button
I past the link in a new tab
In my case I get redirected from http://localhost:9001/?path=/story/exercise-headers--sound-header&knob-Characters=4&knob-Sound Status=SOUND_PLAYING&knob-image= to selected option is not anymore selected

@nicgirault which version?

"@storybook/addon-actions": "^5.0.11",
"@storybook/addon-knobs": "^5.0.11",
"@storybook/addon-links": "^5.0.11",
"@storybook/addons": "^5.0.11",
"@storybook/react": "^5.0.11",
"@storybook/theming": "^5.0.11",

And here is the code of the story I tried:

storiesOf('Exercise/Headers', module)
  .add('Sound Header', () => {
    const characterIndex = select(
      'Characters',
      forestCharacters.map((_, index) => index),
      0
    )

    const soundStatus = select(
      'Sound Status',
      { SOUND_PLAYING, SOUND_REPEAT, None: null },
      SOUND_PLAYING
    )

    const image = boolean('image', false)

    return (
      <SoundHeaderBase
        characterIndex={characterIndex}
        soundStatus={soundStatus}
        onClick={action('click header')}
        isSuccess={null}
        showContent={true}
        image={image ? 'alligator' : null}
      />
    )
  })

@nicgirault can you try updating to the latest? I think this was fixed at some point but I cannot find the exact PR at the moment.

This still doesn't seem to work with version 5.3.8 :(

This is working in official-storybook, try the knobs stories:

https://next--storybookjs.netlify.com/official-storybook/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zvictor picture zvictor  路  3Comments

shilman picture shilman  路  3Comments

shilman picture shilman  路  3Comments

wahengchang picture wahengchang  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments