question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Async fetch and pagination

See original GitHub issue

There 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ericgiocommented, Oct 30, 2017

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.

0reactions
andy9775commented, Oct 30, 2017

Hey, useCache={false} fixed the issue and I agree, seems to me like it should work with cached results.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found