#PreloadedQuery Cache
3 messages · Page 1 of 1 (latest)
Based on the available knowledge sources, there is no documented cache helper or equivalent mechanism for usePreloadedQuery that works like the query cache helper for useQuery. The query cache helper (e.g., ConvexQueryCacheProvider from convex-helpers) is specifically designed for useQuery and related hooks to provide persistent, subscription-based caching across navigation and remounts, reducing unnecessary loading states and network requests Stack: Magic caching.
For usePreloadedQuery, the documented pattern is to preload data on the server using preloadQuery and then pass the resulting Preloaded payload to a client component, where usePreloadedQuery will hydrate the initial value and keep it reactive. However, there is no mention of a cache provider or helper that would persist or share this preloaded data across navigations or remounts in the same way as the useQuery cache helper does Convex Docs: Next.js Server Rendering Convex Docs: usePreloadedQuery.
If you need persistent caching behavior for preloaded queries, you may need to implement a custom solution or consider using useQuery with the cache helper where possible. If you have a specific use case, you might want to share it with the Convex team or community for further guidance, as this is a common area of interest but not currently covered by built-in helpers for usePreloadedQuery.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@rugged valve Kapa.ai is still learning and improving, please let me know how I did by reacting below.