MCPcopy Create free account
hub / github.com/TanStack/db / useDebouncedTransaction

Function useDebouncedTransaction

packages/react-db/tests/usePacedMutations.test.tsx:175–189  ·  view source on GitHub ↗
(opts?: {
        wait?: number
        trailing?: boolean
        leading?: boolean
      })

Source from the content-addressed store, hash-verified

173
174 // Simulate the exact user scenario: custom hook wrapping usePacedMutations
175 const useDebouncedTransaction = (opts?: {
176 wait?: number
177 trailing?: boolean
178 leading?: boolean
179 }) => {
180 return usePacedMutations({
181 onMutate,
182 mutationFn,
183 strategy: debounceStrategy({
184 wait: opts?.wait ?? 3000,
185 trailing: opts?.trailing ?? true,
186 leading: opts?.leading ?? false,
187 }),
188 })
189 }
190
191 const { result, rerender } = renderHook(() => useDebouncedTransaction())
192

Callers 1

Calls 2

usePacedMutationsFunction · 0.90
debounceStrategyFunction · 0.90

Tested by

no test coverage detected