Select does not display options initially when filterOption prop is specified
See original GitHub issueVersion 3.2.0
seemed to introduce an issue where options are not displayed when there is not input value and the filterOption
prop is present. This worked fine in version 3.1.1
Working example https://codesandbox.io/s/311-working-301yt
Nonworking example https://codesandbox.io/s/320-not-working-ibgc7?file=/example.js:389-445
To reproduce, click the select in both examples and notice that options are only displayed in the 3.1.1
example. Options are however rendered when there is an input present in the 3.2.0
example.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
React-select sometimes doesn't display the options in the ...
I'm using "react-select": "^3.0.4", and had to add filterOption={false} prop.
Read more >Select documentation for React | Mobiscroll
The Mobiscroll Select component has a data option (or data prop), that is used to define the selection options. The data option receives...
Read more >Advanced - React Select
React-Select exports a createFilter function that returns a filterOption method. By using this, users can pick and choose bits of the filtration logic...
Read more >Select - Ant Design
A dropdown menu for displaying choices - an elegant alternative to the native ... Specify the prop name of Option which will be...
Read more >Apply a filter to view select records in an Access database
You can use filters to display specific records in a form, report, query, ... filter each column or control separately, or use an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Greetings,
Thanks for the find @h3rmanj !
Some next steps I think to put around this:
maxOptions
can be specified in the filterOptions and/or the filterOptions function exposes an index to allow the user this ability.Thoughts?
After some debugging, I’ve found that it’s this change that broke it. https://github.com/JedWatson/react-select/pull/3990 Specifically the equality check on
selectValue
. I’ll try to throw in a PR. Edit: Nevermind, the code has changed too much from this. The reason it doesn’t work anymore is bcbuildCategorizedOptions
is called multiple times per render, meaning filterOptions get called 2-5 times per option. Maybe it should be memoized?