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

FIX knobs select to actually support rich values #4522

Merged
merged 2 commits into from
Oct 23, 2018

Conversation

ndelangen
Copy link
Member

Fixes: #4402

@ndelangen
Copy link
Member Author

@sapkra This should truly fix the issue.

The problem was indeed that trying to set a rich value as a value on <select> doesn't work.

So In this PR I'm mapping back to the object-key (which should always be a string).

Also simplified the code a bit.

@ndelangen
Copy link
Member Author

If you'd like to review the code perhaps?

@codecov
Copy link

codecov bot commented Oct 23, 2018

Codecov Report

Merging #4522 into master will not change coverage.
The diff coverage is 75%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #4522   +/-   ##
======================================
  Coverage    35.7%   35.7%           
======================================
  Files         557     557           
  Lines        6708    6708           
  Branches      879     879           
======================================
  Hits         2395    2395           
  Misses       3858    3858           
  Partials      455     455
Impacted Files Coverage Δ
addons/knobs/src/components/types/Select.js 76.92% <75%> (ø) ⬆️

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 38ae063...c98a11a. Read the comment docs.

@ndelangen ndelangen merged commit 45c4055 into master Oct 23, 2018
@ndelangen ndelangen deleted the knobs/fix-select-richvalues branch October 23, 2018 13:54
const SelectType = ({ knob, onChange }) => {
const { options } = knob;
const entries = Array.isArray(options)
? options.reduce((acc, k) => Object.assign(acc, { k }), {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be {[k]: k} instead of {k}

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.

2 participants