vtaits / react-select-async-paginate

Wrapper above react-select that supports pagination on menu scroll
MIT License
303 stars 75 forks source link

Serious Breaking Bug: It keeps on fetching when there is an error on first load #173

Closed saver711 closed 1 day ago

saver711 commented 1 month ago

What is the current behavior?

It keeps on fetching when the is error on first load

What is the expected behavior?

it should try once and maybe have retry icon to retry

Sandbox Link

LINK

Reproduce

just change the URL to simulate an error and try to open the select and notice browser's network tab

vtaits commented 1 month ago

Hello. I haven't figured out what to do in case of an error. Stopping loading after error doesn't seem a good solution because it may be caused by a short internet disconnection. Perhaps needs to consider a new property like reloadOnErrorTimeout.

As fast solution of your case you can wrap the fetch flow in a try/catch block.

saver711 commented 1 month ago

@vtaits ok but what to do in catch block can u try to edit on the Stackblitz i can't find a way to stop api calls the select is making i really like this package and i want to use it but this behavior breaks the app

Mainly what we need to do is:

vtaits commented 1 month ago

@saver711 https://stackblitz.com/edit/react-ts-react-select-async-paginate-qyk6df?file=index.tsx

saver711 commented 1 month ago

@vtaits How would you refetch?

vtaits commented 1 month ago

Type something in the input or refresh the page. I'll implement reloadOnErrorTimeout in the next version.

jpgcarvalho commented 2 days ago

I'm facing the same error, when will this new feature be available?

vtaits commented 1 day ago

Hello. Published in 0.7.6