useInfiniteQuery and usePaginatedQuery : Caching
Previously, when I was using Prisma and Neon with React Query (useInfiniteQuery), this caching behavior worked seamlessly. However, after migrating to Convex and using usePaginatedQuery, I'm running into issues due to its real-time subscription model. The posts are not being cached as expected, which results in unnecessary refetches and skeletons when navigating back to the main feed. While individual post pages load fine, the main feed redundantly refetches data — something I’d like to avoid.
Ideally, I want infinite caching behavior where previously loaded pages persist and new posts are fetched on a hard refresh, not on navigation. Unfortunately, I haven’t found a reliable way to replicate this caching behavior using usePaginatedQuery in Convex or to integrate it effectively with React Query.
I’m migrating to Convex mainly for its speed, which I really like. I found the cache helper, but the note about “subscription caching will mean strictly more bandwidth usage” concerns me. Is there a recommended way to avoid re-querying paginated posts on each navigation? Ideally, I’d like previously loaded posts to persist without using extra bandwidth unnecessarily. And I believe that fetching on each navigation would not be ideal as well.
