Repository navigation
Is it possible to have a completely offline Web app? #3867
|
URQL is working perfectly and is a joy to use. What I'm interested is having an app run completely from cache for "Trial" or "Free Tier" users. It seems like it's possible – I see the IndexedDB created and works as expected, but trying requestPolicy: "cache-only", I just get null for the data, even when I've been online and the cache has been populated first. I don't mind writing my own resolvers or updates. Is there a way to offlineExchange without any network requests? I've searched through the forums and haven't found a specific answer. Cheers! |
Replies: 1 comment
|
The So the shape is: |
offlineExchangeis for persistence/offline-first behavior; it is not a global “never hit the network” switch. If you want a tier that runs only from local data, userequestPolicy: 'cache-only'for those operations, or build that client withoutfetchExchangeat all.The
nullresult usually means Graphcache cannot fully satisfy that exact query from the normalized cache. Being “online once” is not enough unless the previous operations wrote all requested entities/fields and Graphcache can resolve the query shape. For a local-only tier, make the cache schema-aware, add keys/resolvers for non-id objects, and add mutationupdates/optimistic writes so every offline query can be answered from th…