JedWatson / JedWatson/react-select
Unable to disable option Groups to support options with property "options"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
This code assumes that if an Option has a options property then it MUST be a Group. In my use case, I have no need for a Group, but my option object does indeed have an options property, and so the Select assumes it has option groups anyways and excludes most of my options with empty options property.
It seems to me the solution probably involves one or more of the following:
- Add a prop to
Selectto allow enabling of groups, e.g.isGrouping,isGroups, etc. Make that part of the condition here instead. - Add a prop to allow the user to configure the property that drives option groups, e.g.
groupOptionsKey, or a functional version, e.g.getGroupOptions.
Example (notice "Ocean" is filtered out): https://codesandbox.io/s/option-groups-bug-s3pzm
If you guys agree with the issue and any of the solutions and need someone to make a PR, I'd be happy to if it helps. Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the referenced Select.js line around option grouping and reproduce the behavior with the linked CodeSandbox, where "Ocean" is filtered out. Compare the proposed grouping-control and configurable-key approaches, then verify that options with an options property are retained when grouping is not intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100