Skip to content

Added isMulti on AsyncSelect and Async (loadOptions) doesn't work #5473

@jechazelle

Description

@jechazelle

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:

Capture d’écran 2022-11-08 à 21 32 49

I used "react-select": "^5.6.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-author-responseIssues or PRs waiting for more information from the authorissue/bug-unconfirmedIssues that describe a bug that hasn't been confirmed by a maintainer yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions