Loading older todos

It might not be always ideal to load all the todos in the database. You would want to have some kind of pagination to enforce fetching data incrementally.

In this app, we will implement the basic functionality of loading older todos on a button click.

The ideal workflow to implement this feature would be:

  1. Start with loading only "n" items
  2. On "load more", fetch "n" more items older than the oldest local item
  3. Append the newly loaded items to apollo cache

You will learn:

  1. Ideas behind implementing pagination in GraphQL
  2. To update apollo cache whenever required

Lets do it.

Did you find this page helpful?
Start with GraphQL on Hasura for Free
  • ArrowBuild apps and APIs 10x faster
  • ArrowBuilt-in authorization and caching
  • Arrow8x more performant than hand-rolled APIs
Promo
footer illustration
Brand logo
© 2024 Hasura Inc. All rights reserved
Github
Titter
Discord
Facebook
Instagram
Youtube
Linkedin
graphql-handbook