Async fetch and pagination
See original GitHub issueThere seems to be an issue with AsyncTypeahead
and pagination. I’m fetching a list of data from my backend when a user enters in a search query. My backend also paginates the results (as there can potentially be thousands so I’d like to limit the result count). I’d like to be able to pass in a paginate={true}
prop whenever there is more data to be fetched from the backend. This doesn’t seem to be working at the moment. From what I gather, the default pagination behavior is to paginate on the options that are already provided which doesn’t allow the options array to grow.
Any thoughts on how to go about this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Handling Pagination with Async Iterators - DEV Community
You can extract the code that handles the pagination by converting the whole block into an async function.
Read more >Simple Pattern for Paging or Looping Through Requests with ...
As part of providing some API usage examples, I worked up an example that includes how to page through an Api using async/await....
Read more >Javascript async iterators to fetch data from paginated REST api.
Javascript async iterators to fetch data from paginated REST api. - asynciterators.js.
Read more >Using Javascript Async Iterator to Fetch Data From Paginated ...
In this article I will explain how to use Javascript async iterators to iterate through a paginated data set. Just for demonstration purpose ......
Read more >fetch-paginate - GitHub Pages
Fetches multiple pages from paginated APIs with fetch (using either Link headers like GitHub, or with customizable page or offset & limit query...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After thinking about it some more, my feeling is that the built-in cache is for basic use cases and pagination falls outside of that. You’d need to make a lot of assumptions about how the pagination works so I think that’s best left to the developer. I added a pagination example as one possible solution, but I imagine there could be lots of variations.
Hey,
useCache={false}
fixed the issue and I agree, seems to me like it should work with cached results.