urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.61k stars 449 forks source link

docs: Add more extensive infinite pagination example code #3258

Closed kitten closed 1 year ago

kitten commented 1 year ago

Add example for UI-only infinite pagination to our examples folder, that doesn't keep an array of variables, and instead renders pages dynamically and recursively, which is often preferable, and also restores all pages on initial mount against the cache.

While this is a simple pattern, it's often overlooked and not considered. Worst of all, because we had no example of this, it was hard to communicate this as a real example to handling infinite pagination via:

Which is all not preferable to this new example, unless a flat list of items is needed (in such a case, Graphcache's pagination helpers are still preferred)