pollInterval not working with offset-based fetchMore pagination
See original GitHub issueI’m using fetchMore
to implement offset-based pagination as suggested in the docs, and that works. But when I add pollInterval
to refresh the data, it wipes out all the newly loaded data every time the interval triggers.
What am I doing wrong?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:34 (14 by maintainers)
Top Results From Across the Web
Core pagination API - Apollo GraphQL Docs
Our fetchMore function is ready, but we're not finished! ... section use offset-based pagination, but this article applies to all pagination strategies.
Read more >Poll interval option on Apollo client useQuery hook not working
I have a simple forum-like app using apollo server and client(react) and I am trying to periodically update the posts on the main...
Read more >Pagination – Angular - GraphQL Code Generator
Pagination is the most common solution to this problem, ... Offset based pagination - also called numbered pages - is a very common...
Read more >GraphQL Pagination Primer: Offset vs. Cursor vs. Relay-Style ...
Historically, offset-based pagination has been a popular choice for ... A cursor-based approach has the downside of not providing any way to ...
Read more >How to implement infinite scroll with GraphQL and React
How can you create infinite scroll offset-based pagination in your React ... fetchMore() that you can use to implement offset pagination with infinite ......
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
Wouldn’t this issue actually be solvable when a
poll
used anupdateQuery
similar tofetchMore
? IfupdateQuery
had a parameter that told us if it was triggered by a poll, or a fetchMore request, we could update theprevResult
withfetchMoreResult
/pollResult
accordingly.I have an infinite list that uses
fetchMore
, but needs to be polled for items (think twitter). So basically same problem as y’all. This is how I solved it:My API is already implementing the cursor approach where I send the id of the latest item and it’ll give me the next 10.
firstItemId
to my api where instead of sending the next 10, it returns all newer itemsfirstItemId
every 2 secondsonCompleted
to manually add the new items to the cacheSo far it works. I can’t quite decide if it’s a clever solution or just a giant hack. Maybe it’s both 😄
@smeijer 's suggestion would 💯 fix this problem. Hope it gets implemented some time!