function debounceStrategy(options): DebounceStrategy;
function debounceStrategy(options): DebounceStrategy;
Defined in: packages/db/src/strategies/debounceStrategy.ts:28
Creates a debounce strategy that delays transaction execution until after a period of inactivity.
Ideal for scenarios like search inputs or auto-save fields where you want to wait for the user to stop typing before persisting changes.
Configuration for the debounce behavior
A debounce strategy instance
const mutate = usePacedMutations({
onMutate: (value) => {
collection.update(id, draft => { draft.value = value })
},
mutationFn: async ({ transaction }) => {
await api.save(transaction.mutations)
},
strategy: debounceStrategy({ wait: 500 })
})
const mutate = usePacedMutations({
onMutate: (value) => {
collection.update(id, draft => { draft.value = value })
},
mutationFn: async ({ transaction }) => {
await api.save(transaction.mutations)
},
strategy: debounceStrategy({ wait: 500 })
})
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
