JedWatson / JedWatson/react-select

Unable to disable option Groups to support options with property "options"

Open
#3,706 7 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue/bug-confirmed
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:

  1. Add a prop to Select to allow enabling of groups, e.g. isGrouping, isGroups, etc. Make that part of the condition here instead.
  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.