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

4.0.0-rc.6: knob "select" with a simple array only shows a "k" option #4560

Closed
ghost opened this issue Oct 25, 2018 · 8 comments
Closed

4.0.0-rc.6: knob "select" with a simple array only shows a "k" option #4560

ghost opened this issue Oct 25, 2018 · 8 comments

Comments

@ghost
Copy link

ghost commented Oct 25, 2018

select("locale", ["es", "en"], "en")

  • @storybook/4.0.0-rc.6

storybook 2018-10-25 08-15-40

@ghost
Copy link
Author

ghost commented Oct 25, 2018

@ndelangen FYI

@diagramatics
Copy link
Contributor

Found out the issue, fix is in #4586.

@ghost
Copy link
Author

ghost commented Oct 29, 2018

@diagramatics @ndelangen it still does not work on 4.0.0

@teddybradford
Copy link

I'm running into the same issue. I don't think this was actually fixed. :(

@diagramatics
Copy link
Contributor

Just checked, turns out the PR isn't cherry picked in 4.0.0. @shilman do you mind revisiting this for us?

@Drapegnik
Copy link

Drapegnik commented Oct 30, 2018

@danielg2002 @teddybradford @diagramatics, temporarily fixed it with https://github.com/ds300/patch-package

patches/@storybook/addon-knobs+4.0.0.patch:

patch-package
--- a/node_modules/@storybook/addon-knobs/dist/components/types/Select.js
+++ b/node_modules/@storybook/addon-knobs/dist/components/types/Select.js
@@ -21,7 +21,7 @@ var SelectType = function SelectType(_ref) {
   var options = knob.options;
   var entries = Array.isArray(options) ? options.reduce(function (acc, k) {
     return Object.assign(acc, {
-      k: k
+      [k]: k
     });
   }, {}) : options;
   var selectedKey = Object.keys(entries).find(function (k) {

@shilman
Copy link
Member

shilman commented Oct 31, 2018

@diagramatics I'll get it into a release today.

shilman pushed a commit that referenced this issue Oct 31, 2018
(bug) Fix Select array values showing k (fixes #4560)
@shilman
Copy link
Member

shilman commented Oct 31, 2018

Released: https://github.com/storybooks/storybook/releases/tag/v4.0.1

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

No branches or pull requests

4 participants