Fix select controls to handle groups in reactions#1516
Fix select controls to handle groups in reactions#1516ovidiuch merged 7 commits intoreact-cosmos:mainfrom
Conversation
`options` of `FixtureStateSelectControl` now accepts an array of objects with `group` and `options` in addition to an array of strings. This commit also updates the use of `options` in `useSelect` and `Select` to handle groups, and defines `GroupedOptions` and `isGroupedOptions` in a separate file shared among multiple components. Finally, a new fixture in `Select.fixture.tsx` showcases the new `group`ed options for rendering select controls.
ovidiuch
left a comment
There was a problem hiding this comment.
Looks pretty good! A few changes and a useSelect test and we can merge it. If you find creating the test confusing let me know and I can help.
packages/react-cosmos-ui/src/components/inputs/Select.fixture.tsx
Outdated
Show resolved
Hide resolved
packages/react-cosmos-ui/src/plugins/ControlSelect/SelectValueInput.tsx
Outdated
Show resolved
Hide resolved
|
Just realized this also needs attention: Stringifying the options list is a trick make the options list a dependency of that hook without invalidating the effect on every render even if the options list is identical. But stringifying an array of string is the equivalent of |
|
@max-scopp are you still interested in getting this merged? I can help if needed :). |
|
Figured out I had write access on the fork so I made the changes myself 😉 |
See #1513