__isNew__ options always showing even when filtering
See original GitHub issueAre you reporting a bug or runtime error?
In V5 using creatable
and filterable
options, when an option has __isNew__: true
it will always show in the options, even when filtering.
This issue didn’t exist in v4, and there is no mention of it in the changelog.
This issue is caused by this line: https://github.com/JedWatson/react-select/blob/cfd5d9f632b4a8b699fba1028d3243735428e428/packages/react-select/src/filters.ts#L28
Was introduce by this PR: https://github.com/JedWatson/react-select/pull/4702 Which doesn’t mention this being an indented behaviour.
Video: https://www.loom.com/share/e343c5d9770544c398a3c3d5537c649d
See this video of the difference between React-Select 4 and 5. https://www.loom.com/share/9c7aff61336a475398750539200957a7
Codesandbox: https://codesandbox.io/s/codesandboxer-example-forked-o2wlz?file=/example.tsx
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
I don’t think we considered multiple Selects sharing the same array of creatable options. The thinking was: what is the use case for not showing the “creatable” option? For example, if the creatable option label did not include the text that the user was typing (e.g., if it was just a fixed label) then it might be unintentionally filtered. The fact that it would be filtered out in that scenario was considered a bug which is why we didn’t categorize it as a breaking change. We’ll discuss this at our maintainers meeting and figure out what we want the intended behavior to be going forward.
Thanks for all your input @Methuselah96
We fixed this on our side some time ago but overwriting the options properties.
I still think the current behaviour doesn’t make a lot of sense - to me a filter should always be applied when you are filtering. Regardless of the isNew property. But I understand you might see it differently.
Happy for this to be closed, if this is going to stay as intended behaviour.