holdenH
Convex Community3y ago
7 replies
holden

Debouncing mutations?

hi! I'm using Convex to store/update the state of a "project" object in my app.

My naive approach works fine (and feels very fast), except in one case where I have a slider that feels very laggy (I think because it's attempting to update state many times/sec during the drag).

What's the best way to fix this?

After reading your docs, I was considering adding the useSingleFlight hook to throttle my mutations, and use optimistic updates to keep my local state/app feeling fast. Does it sound right that I should do both of these, or is that overcomplicating?

Ideally, I want my local state to update instantly so my app feels snappy, even if mutations to the server are throttled somehow.

(just looking for a pointer that I'm on the right track before I go implement all of this - thanks!)
Was this page helpful?