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

Force render on knob button click and update example #3650

Merged
merged 5 commits into from
May 27, 2018

Conversation

Keraito
Copy link
Contributor

@Keraito Keraito commented May 25, 2018

Issue: As discussed on Slack, the callback of the button knob didn't seem to do something. What actually happened was that clicking the button didn't trigger a re-render, so the results of the callback were never visually visible.

There was an example in the official-storybook, but that basically used the knob button inside a react component defined in the stories file and triggered a setState call to force a render of the component itself. The example itself described that this was not the best way to do this.

What I did

  1. Force a re-render on button click.
  2. Change the example to make the knob button change the values of the injected props to the component.

cc @ndelangen as he was part of the discussion

@Keraito Keraito added addon: knobs patch:yes Bugfix & documentation PR that need to be picked to main branch labels May 25, 2018
@codecov
Copy link

codecov bot commented May 26, 2018

Codecov Report

Merging #3650 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #3650   +/-   ##
======================================
  Coverage    40.1%   40.1%           
======================================
  Files         479     479           
  Lines        5236    5236           
  Branches      862     862           
======================================
  Hits         2100    2100           
  Misses       2618    2618           
  Partials      518     518
Impacted Files Coverage Δ
addons/knobs/src/registerKnobs.js 0% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62e42f8...3a513fa. Read the comment docs.

@Hypnosphi
Copy link
Member

Feel free to merge after CI passes

@Hypnosphi Hypnosphi added bug and removed patch:yes Bugfix & documentation PR that need to be picked to main branch labels May 26, 2018
@Hypnosphi
Copy link
Member

Please update storyshots: yarn test --core --update

@Hypnosphi Hypnosphi merged commit 6887a6c into storybookjs:master May 27, 2018
@pvinis
Copy link
Contributor

pvinis commented Jun 26, 2018

this doesnt seem to work for react native..

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

Successfully merging this pull request may close these issues.

3 participants