Description
Are you reporting a bug or runtime error?
A bug, I believe.
react-select
is not updating the disabled items between renders, even if the result of isOptionDisabled
change between renders.
Expected behavior
react-select
should run isOptionDisabled
on every render/re-render to decide which options should be disabled on that render
Use case scenario
I have a list of items that the user can select and some of those items should be disabled/enabled for selection based on other user inputs in that same form.
As of now, it seems disabled options are calculated only on the very first render (once it mounts) and isOptionDisabled
is ignored on the subsequent renders.
Code Example
I have put on an example at: https://codesandbox.io/s/modest-platform-4w4g3?file=/example.js
This example has a toggle that decides whether options should be enabled or disabled. As you will see, it renders them correctly initially, on the first render with the initial disabled value, but fails to update the disabled options in subsequent renders as you toggle the disabled value.