hari
hariβ€’11mo ago

can optimisticUpdate be use in production ? any repo example ?

I need to use optimistic update in convex.
11 Replies
FleetAdmiralJakob πŸ—• πŸ—— πŸ—™
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.
FleetAdmiralJakob πŸ—• πŸ—— πŸ—™
@hari Also this is a beta feature so it can be changed in the future
No description
hari
hariOPβ€’11mo ago
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
FleetAdmiralJakob πŸ—• πŸ—— πŸ—™
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
hari
hariOPβ€’11mo ago
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 ?
FleetAdmiralJakob πŸ—• πŸ—— πŸ—™
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
Michal Srb
Michal Srbβ€’11mo ago
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.
erquhart
erquhartβ€’11mo ago
Data point: I've been using optimistic updates for over six months and haven't yet encountered a bug.
hari
hariOPβ€’11mo ago
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 ?
erquhart
erquhartβ€’11mo ago
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)
Michal Srb
Michal Srbβ€’11mo ago
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).

Did you find this page helpful?