Skip to content
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

Options disappear after select one in Multi #118

Open
RicardoHds opened this issue Jun 15, 2022 · 7 comments
Open

Options disappear after select one in Multi #118

RicardoHds opened this issue Jun 15, 2022 · 7 comments

Comments

@RicardoHds
Copy link

I have a the following AsyncPaginate in two different component and requests (Multi Select).

  1. The first one works very well, when I select one option the rest of the options keeps on the select. This request have +100 records.
  2. The sencond one component is exacly the same the only difference is the number of records and page. For this request I have only 11 records and 2 pages, but in the first time I can see all options and select one but after this the rest of the option disappear and the component return "No results".

Also I tried different ways to fix it, configured 4 pages and 2 options each or 3 pages with 3 options.
I don't undestand what is the problem of it is the same implementation the difference is only the total records to show.

Any suggestion?

<AsyncPaginate isMulti isSearchable value={value} loadOptions={loadOptions} onChange={onChange} additional={{ page: 1 }} />

@vietd7
Copy link

vietd7 commented Jun 20, 2022

you shoud add props getOptionValue like this
getOptionValue={(option) => option.id}

@ImGelu
Copy link

ImGelu commented Nov 8, 2022

I'm having the same problem. @vtaits any updates on this? (I'm also using getOptionValue and getOptionLabel)

@vtaits
Copy link
Owner

vtaits commented Dec 5, 2022

Hello. Can you make a sandbox example?

@ayuka-bg
Copy link

example with SWAPI
https://codesandbox.io/s/react-hook-form-example-forked-m6w4gd

but with correct getOptionValue works well, without - infinity loading -> no options -> loading

@ianchanning
Copy link

@ayuka-bg That's a great example - but I didn't spot what you meant at first. Could you maybe create a separate multi-select dropdown without the getOptionValue to show how it fails?

@ianchanning
Copy link

Actually I forked it show what I mean:

Screenshot from 2024-02-22 08-30-23

@ianchanning
Copy link

Note that weirdly I hit this problem when switching from the Apollo GraphQL client to the urql GraphQL client. I haven't been able to figure out why because the options structure in loadOptions for both of them is the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants