-
-
Notifications
You must be signed in to change notification settings - Fork 345
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 select controls to handle groups in reactions #1516
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: react-cosmos/packages/react-cosmos-renderer/src/fixture/useSelect/useCreateFixtureState.ts Line 39 in f442f14
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