megaserg
megaserg
CCConvex Community
Created by megaserg on 2/22/2023 in #general
Optimistic updates for debounced mutations
@ballingt This works almost verbatim! I made debouncedMut also setLocalState before clearTimeout. And also swapped mut(val) with setTimer(null) so that the typing user doesn't have a microglitch while timer is already null but mutation+query has not applied+refreshed yet.
18 replies
CCConvex Community
Created by megaserg on 2/22/2023 in #general
Optimistic updates for debounced mutations
Thanks a lot! I'll experiment and report back. Haven't written custom hooks before
18 replies
CCConvex Community
Created by megaserg on 2/22/2023 in #general
Optimistic updates for debounced mutations
Suppose I don't do withOptimisticUpdate and let's say I resolve conflicts like "local version trumps remote version if user is typing, remote trumps local otherwise" (poor man's OT/CRDT lol). Then how would the non-typing user get updates? How do I bound their local state with query result?
18 replies