johnslemmerJ
Convex Community6mo ago
1 reply
johnslemmer

convex client offline behavior?

I see a couple other posts about local first and offline stuff. And I see here that there is at least some form of retry logic when a convex client is offline and trying to make mutations: https://docs.convex.dev/client/react#retries

I specifically have a react native/expo app that will be offline for days at a time. I was hoping to not have to go full local-first architecture depending on the deeper logic and architecture of the convex client. Here are my questions?

- does the convex client keep the queue of mutations in memory (not local storage, or similar on react native)? ie. lost if the app is killed?
- any limitations on the size of that storage? Number of mutations it can queue?
- Will these mutations eventually be ran in order?
- Is there any way to manage the queued mutations, like delete certain ones that may be repetitive?
- What does the isWebSocketConnected https://docs.convex.dev/api/modules/browser#connectionstate here mean. Is it that the socket connection is open and the last ping was acknowledged? How often is the ping over the websocket?
- Do inflight... properties on the above status object mean "sent to server and waiting on response"? Or just that the client has made the request (ie called mutation) and it either hasn't sent the request to the server (queued) or it has sent and we are still waiting on the response?

Anyway, appreciate any details. Love your product BTW!

I'm guessing using the tanstack query integration and this persist plugin may more be my answer (https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient#how-it-works) but also open to hear any other ideas. Thanks!
This is set of utilities for interacting with "persisters" which save your queryClient for later use. Different persisters can be used to store your client and cache to many different storage layers....
persistQueryClient | TanStack Query React Docs
React client library for interacting with your Convex backend
Convex React | Convex Developer Hub
Tools for accessing Convex in the browser.
Module: browser | Convex Developer Hub
Was this page helpful?