-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added shouldReloadOptions option to Async component #1480
Conversation
Can this be merged, got the same problem? |
+1 |
@dave-clover No. This is thought as an addition to disabling the cache. |
Is there anything preventing this from being merged in? I'm using a pretty ugly workaround to mimic this behavior by conditionally rendering two different components that are nearly identical aside from their loadOptions function. It would be nice to have this as a built in option instead. |
Is this at npm ? or not released yet? |
I have the same problem on my app. :( |
Could you fix your PR @VanCoding ? |
fixed. |
@VanCoding thanks ;) |
Any news on this? I also need to refresh the options due to cascading selects dependency. |
That would be great to have! |
I'm also waiting on this cool little feature :) |
Any news on this ? |
can we get an example of how shouldReloadOptions is to be used? I must be stupid.... shouldReloadOptions={true} EDIT: looks like I should pass a function shouldReloadOptions={this.reload} and whenever I want it to reload i execute this.reload() ? |
Hey @VanCoding v1 of react-select is no longer maintained. Thanks for taking your time out to create this PR but since this PR has changes for We highly recommend upgrading from v1 to v2. I'm closing this issue/PR now. Feel free add your thoughts in #3981 and reference this issue/PR if needed. |
Hi @JedWatson
I had the need to add an option to the Async component that lets it automatically reload its options when it receives new props or the user opens the list.
As use case, imagine the following UI:
Client: [Client Select Box]
Invoice: [Invoice Select Box]
The invoice select box lets you select an invoice of the client selected in the client select box.
As soon as you select a different client, and then want to select the invoice, you should get the invoices of the new client.
Currently, the Async component assumes that a call to
loadOptions
with the same search term will always return the same options, and therefore does not reload its options when receiving new props, or opening the list. But in the use case above, that is not the case.loadOptions
would return different options, if it was called. But it isn't!That's why I added the option
shouldReloadOptions
, which is a function that, when called, returns a boolean value indicating if a call toloadOptions
would return different results than before. If it returns true, the Async component then automatically reloads its options.What do you think?