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

Created on 25 Oct 2018  路  8Comments  路  Source: storybookjs/storybook

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

  • @storybook/4.0.0-rc.6

storybook 2018-10-25 08-15-40

Most helpful comment

All 8 comments

@ndelangen FYI

Found out the issue, fix is in #4586.

@diagramatics @ndelangen it still does not work on 4.0.0

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

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

@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) {

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rpersaud picture rpersaud  路  3Comments

shilman picture shilman  路  3Comments

tomitrescak picture tomitrescak  路  3Comments

ZigGreen picture ZigGreen  路  3Comments

MrOrz picture MrOrz  路  3Comments