File: AsyncBatcherOptions.md | Updated: 11/15/2025
Search...
+ K
Auto
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide
Documentation
Framework
React
Version
Latest
Search...
+ K
Menu
Getting Started
Guides
API Reference
Debouncer API Reference
Throttler API Reference
Rate Limiter API Reference
Queue API Reference
Batcher API Reference
Debouncer Examples
Throttler Examples
Rate Limiter Examples
Queue Examples
Batcher Examples
TanStack Query Examples
Framework
React
Version
Latest
Menu
Getting Started
Guides
API Reference
Debouncer API Reference
Throttler API Reference
Rate Limiter API Reference
Queue API Reference
Batcher API Reference
Debouncer Examples
Throttler Examples
Rate Limiter Examples
Queue Examples
Batcher Examples
TanStack Query Examples
On this page
Copy Markdown
Interface: AsyncBatcherOptions<TValue>
======================================
Defined in: async-batcher.ts:89
Options for configuring an AsyncBatcher instance
Type Parameters
---------------
### TValue
TValue
Properties
----------
### asyncRetryerOptions?
ts
optional asyncRetryerOptions: AsyncRetryerOptions<(items) => Promise<any>>;
optional asyncRetryerOptions: AsyncRetryerOptions<(items) => Promise<any>>;
Defined in: async-batcher.ts:93
Options for configuring the underlying async retryer
ts
optional getShouldExecute: (items, batcher) => boolean;
optional getShouldExecute: (items, batcher) => boolean;
Defined in: async-batcher.ts:100
Custom function to determine if a batch should be processed Return true to process the batch immediately
TValue[]
AsyncBatcher <TValue>
boolean
ts
optional initialState: Partial<AsyncBatcherState<TValue>>;
optional initialState: Partial<AsyncBatcherState<TValue>>;
Defined in: async-batcher.ts:107
Initial state for the async batcher
ts
optional key: string;
optional key: string;
Defined in: async-batcher.ts:112
Optional key to identify this async batcher instance. If provided, the async batcher will be identified by this key in the devtools and PacerProvider if applicable.
ts
optional maxSize: number;
optional maxSize: number;
Defined in: async-batcher.ts:117
Maximum number of items in a batch
ts
Infinity
Infinity
ts
optional onError: (error, batch, batcher) => void;
optional onError: (error, batch, batcher) => void;
Defined in: async-batcher.ts:123
Optional error handler for when the batch function throws. If provided, the handler will be called with the error, the batch of items that failed, and batcher instance. This can be used alongside throwOnError - the handler will be called before any error is thrown.
Error
TValue[]
AsyncBatcher <TValue>
void
ts
optional onItemsChange: (batcher) => void;
optional onItemsChange: (batcher) => void;
Defined in: async-batcher.ts:131
Callback fired after items are added to the batcher
AsyncBatcher <TValue>
void
ts
optional onSettled: (batch, batcher) => void;
optional onSettled: (batch, batcher) => void;
Defined in: async-batcher.ts:135
Optional callback to call when a batch is settled (completed or failed)
TValue[]
AsyncBatcher <TValue>
void
ts
optional onSuccess: (result, batch, batcher) => void;
optional onSuccess: (result, batch, batcher) => void;
Defined in: async-batcher.ts:139
Optional callback to call when a batch succeeds
any
TValue[]
AsyncBatcher <TValue>
void
ts
optional started: boolean;
optional started: boolean;
Defined in: async-batcher.ts:148
Whether the batcher should start processing immediately
ts
true
true
ts
optional throwOnError: boolean;
optional throwOnError: boolean;
Defined in: async-batcher.ts:154
Whether to throw errors when they occur. Defaults to true if no onError handler is provided, false if an onError handler is provided. Can be explicitly set to override these defaults.
ts
optional wait: number | (asyncBatcher) => number;
optional wait: number | (asyncBatcher) => number;
Defined in: async-batcher.ts:161
Maximum time in milliseconds to wait before processing a batch. If the wait duration has elapsed, the batch will be processed. If not provided, the batch will not be triggered by a timeout.
ts
Infinity
Infinity
