Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Explain which queries the mobile app saves for offline use

François Zaninotto59f92e967f2a
diff --git a/src/components/atomic-crm/root/CRM.tsx b/src/components/atomic-crm/root/CRM.tsx
index 7bc70e69..645e3ea2 100644
--- a/src/components/atomic-crm/root/CRM.tsx
+++ b/src/components/atomic-crm/root/CRM.tsx
@@ -301,6 +301,11 @@ const MobileAdmin = (
persistOptions={{
persister: asyncStoragePersister,
dehydrateOptions: {
+ // Picks the queries saved to localStorage for offline use: successful
+ // ones (react-query's default rule, inlined because the persister
+ // types its own copy of query-core), except those flagged with
+ // `meta: { persist: false }`, like the global search, which caches one
+ // query per typed term.
shouldDehydrateQuery: (query) =>
query.state.status === "success" && query.meta?.persist !== false,
},