David AlonsoD
Convex Community14mo ago
9 replies
David Alonso

Debounce calls to a mutation without doing so for the optimistic update

Say you have a text field in a Notion-like application (e.g. Fireview in screenshot) where we use optimistic updates to trigger global changes on every keystroke.

In the component we use a mutation like this:
const updatePage = useAuthMutation(
    api.mutations.blocks.auth.pages.updatePageBlock,
    OptimisticUpdate.updatePage
  );

We want the optimistic update to be triggered on every keystroke but it would be great to debounce server mutation calls to save some costs, I just have no idea how to do this...
image.png
Was this page helpful?