JedWatson / JedWatson/react-select
Added isMulti on AsyncSelect and Async (loadOptions) doesn't work
Open
Nobody has claimed this yet.
awaiting-author-response
issue/bug-unconfirmed
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
First : thank you so much for this package!
When I added isMulti on the AsyncSelect, I don't see the different options loaded, always empty:
import AsyncSelect from 'react-select/async';
...
const loadOptions = async (inputValue, callback) => {
let data = await axios.get(route('dashboard.tags.searchTag'), { params: { name: inputValue } }).then((response) => {
const options = [];
response.data.data.forEach((item) => {
options.push(item);
});
return options;
});
callback(data);
};
...
<AsyncSelect
isMulti
value={post.tags}
onChange={handleChange}
loadOptions={loadOptions}
getOptionLabel={(option) => option.name}
/>
Without isMulti on AsyncSelect, I see the different options:
I used "react-select": "^5.6.0"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the AsyncSelect entry point and reproduce the reported example with isMulti, value, loadOptions, and getOptionLabel. Compare the behavior with and without isMulti using the supplied loadOptions implementation. Done means the asynchronously loaded options appear when isMulti is enabled as well as when it is omitted.
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
- 35/100