I'm developping a React Native application and I'm interessed by using the ConvexQueryCacheProvider component to cache query results, as the application is mainly a "read application". If I understand well the example of this component, I cannot initialise the cache state with a default. Or I cannot save the query results in the purpose of restoring the state later.
If the initialisation of the cache would be possible, it would allow my application to start offline and be able to search an information, for example.
Is there the way to initialise the default state of ConvexQueryCacheProvider?
#Query Caching: ConvexQueryCacheProvider initialisation ?
4 messages · Page 1 of 1 (latest)
Hi @simple maple. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the available knowledge sources, there is currently no documented way to initialize the cache state of ConvexQueryCacheProvider with a default value or to restore cached query results for offline startup in a React Native application.
The ConvexQueryCacheProvider is designed to keep query results cached and up-to-date via live subscriptions while your app is online, and it can help avoid unnecessary refetches when navigating between screens. However, it does not support preloading or persisting cache data for offline use or for restoring state after a restart. This means you cannot provide an initial cache state or hydrate the cache from storage to enable offline search or access to previously fetched data.
This limitation is also reflected in community discussions, where users have asked about local-first or offline capabilities, and Convex staff have clarified that Convex does not currently support a local-first paradigm or offline mutations beyond basic optimistic updates. Users must be online to interact with Convex for queries and mutations, except for some optimistic UI patterns and automatic retry of mutations when the network is restored. There is no mention of cache hydration or offline query support in the official documentation or support threads [Discord: Local First React Native].
If offline-first or cache hydration is critical for your use case, you may need to implement a custom solution or consider alternative approaches, as Convex's current caching is focused on real-time, online scenarios [Stack: Magic caching].