react-component / react-component/select

OptionFilterProp should default to the label specified in FieldNames

Open
#709 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

if fieldNames is used to map a label prop AND no optionFilterProp is provided (i.e. default is label) then optionFilterProp should search the label specified by fieldNames.

I find myself doing this:

<Select
    optionFilterProp="displayName"
    fieldNames={{
        label:'displayName',
        value:'id'
    }}
/>

Ideally, I just want to do this:

<Select
    fieldNames={{
        label:'displayName',
        value:'id'
    }}
/>

Contributor guide

No contributing guide indexed for this repository

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 Select component's filtering behavior and trace how optionFilterProp and fieldNames.label are chosen when optionFilterProp is omitted. Add coverage for the displayed-name example and verify that searching with fieldNames={{ label: 'displayName', value: 'id' }} matches displayName without an explicit optionFilterProp.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.