can optimisticUpdate be use in production ? any repo example ?
I need to use optimistic update in convex.
11 Replies
https://github.com/get-convex/convex-chess/blob/65d733a57a73618aa4ccebb16672b5d3b04259a3/pages/play/%5Bid%5D.tsx#L35 This example uses optimistic updates
GitHub
convex-chess/pages/play/[id].tsx at 65d733a57a73618aa4ccebb16672b5d...
Chess built on Convex. Contribute to get-convex/convex-chess development by creating an account on GitHub.
@hari Also this is a beta feature so it can be changed in the future

Thanks, any ETA when will this feature would be out of BETA ?
I made an app like this that can drag and drop and compactable
does not seem to be on the Q 1.5 plan: https://discord.com/channels/1019350475847499849/1019372556693815418/1220856197725294643 but I think you can add your request to add to it the plan in the discussion thread about it
I see thanks π
Do you think itβs better to me to use this beta feature ? Or any other way to solve same problem without useOptimistic ?
Or any other solution outside of convex ?
I think the best is to use this beta feature because the convex support is so good that it fixes your problem instantly. so you will encounter more problems with this beta feature but bug fixes etc. are coming very fast after you reported them.
+ If you give more feedback it will get stable much faster and you can be a part of deciding how this feature will look like. if it's out of beta it will be harder to change this API
The beta label doesnβt mean that the feature is buggy (itβs been unchanged and working well for over a year), itβs there because we might evolve the API which might require code changes for you to upgrade in the future.
Data point: I've been using optimistic updates for over six months and haven't yet encountered a bug.
Thanks guys π @FleetAdmiralJakob π π π @Michal Srb @erquhart
will try to explore.
this optimisticUpdate I just need to update the localStore right ? and the refresh will handle by the mutation ?
My loose understanding is that an optimistic update synchronously results in a temporary update for any
setQuery()
calls, and is overwritten when the data updates upon mutation resolution.
(so yes)The update is actually stored and applied on top of query results until the mutation resolves (this matters in situations where there are either multiple mutations called quickly one after another or when the client gets an update from another write while the in-flight mutation is still being processed by the backend).