question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Knobs update on local story state update

See original GitHub issue

Hi,

Maybe I’m wrong but it seems that knobs addon can’t be updated when using args update. To give you some example I have some sample code which is:

   .add('with storybook 6 using hooks', () => {
        const [args, updateArgs] = useArgs(false);
        console.log('args', args);
        const knobs = {
            name: text('name', 'name'),
            title: text('title', 'Input title'),
            isDisabled: boolean('isDisabled', false),
            //isChecked: boolean('isChecked', args.isChecked || false), // when using this update is blocked
            customClasses: text('customClasses', 'custom-class')
        };
        return (<InputCheckbox
            {...knobs}
            {...otherActions}
            isChecked={args.isChecked || false}
            onChange={(isChecked) => {
                updateArgs({ isChecked });
            }}/>);
    }
    )

old knobs are working fine for me but updating isChecked knob from args doesn’t trigger any change, how can I make it work? As we have many stories to update I would appreciate a simple solution.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, Apr 20, 2020

@Klaudia-Brysiewicz did you try:

   .add('with storybook 6 using hooks', (args) => {
      return (
        <InputCheckbox
          {...args}
          {...otherActions}
        />
      );
    }, {
      argTypes: {
        name: { type: { name: 'string' } },
        title: { type: { name: 'string' } },
        isDisabled: { type: { name: 'boolean' } },
        isChecked: { type: { name: 'boolean' } },
        customClasses: { type: { name: 'string' } },
      }
    }
)
0reactions
stale[bot]commented, Aug 8, 2020

Hey there, it’s me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storybook Knobs not updating - Stack Overflow
I use knobs for both, it works fine of the simple button but it dose not update the larger component (The withInfo addon...
Read more >
Knobs Addon | Storybook: Frontend workshop for UI ...
Storybook Addon Knobs allow you to edit props dynamically using the Storybook UI. You can also use Knobs as a dynamic variable inside...
Read more >
Crews battling blaze at Meridian Township apartment building
No one was injured in the fire at Knob Hill Apartments on Knob Hill Drive, west of Okemos Road, which began around 11...
Read more >
The State News
Firefighters combat fire at Knob Hill Apartments in Okemos, no reported injuries ... Live updates of Michigan State football's early signing day period....
Read more >
Adding new knobs and pulls is an easy, inexpensive way to ...
Adding new knobs and pulls is an easy, inexpensive way to update rooms ... are gaining in popularity among her local clients.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found