Describe the bug
When using options knob valueObjects to be array of Object, on choose of mutil options, the select box would fallback to empty
To Reproduce
Steps to reproduce the behavior:
`
import { optionsKnob } from '@storybook/addon-knobs';
const label = 'Fruits';
const valuesObj = {
Kiwi: { label: 'kiwi' },
Guava: { label: 'Guava' },
Watermelon: { label: 'Watermelon' },
};
const defaultValue = [{ label: 'kiwi' }];
const optionsObj = {
display: 'multi-select',
};
const groupId = 'GROUP-ID1';
const value = optionsKnob(label, valuesObj, defaultValue, optionsObj, groupId);
`
Expected behavior
I think problems goes here:
`
if (isMulti) {
defaultValue = options.filter(function (i) {
return knob.value.includes(i.value);
});
handleChange = function handleChange(values) {
return onChange(values.map(function (item) {
return item.value;
}));
};
}
return _react["default"].createElement(OptionsSelect, {
value: defaultValue,
options: options,
isMulti: isMulti,
onChange: handleChange
});
`
The knob panel receive message back(which is deserialized) , and the
options.filter(function (i) {
return knob.value.includes(i.value);
});
would result in [] because the value are type of object
FYI, we鈥檝e released addon-controls in Storybook 6.0. Controls are portable, auto-generated knobs that are intended to replace addon-knobs long term.
Please upgrade and try them out today!
That's Great! I will try 6.0 and addon-control