File: BatcherOptions.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: BatcherOptions<TValue>
=================================
Defined in: batcher.ts:52
Options for configuring a Batcher instance
Type Parameters
---------------
### TValue
TValue
Properties
----------
### getShouldExecute()?
ts
optional getShouldExecute: (items, batcher) => boolean;
optional getShouldExecute: (items, batcher) => boolean;
Defined in: batcher.ts:57
Custom function to determine if a batch should be processed Return true to process the batch immediately
TValue[]
Batcher <TValue>
boolean
ts
optional initialState: Partial<BatcherState<TValue>>;
optional initialState: Partial<BatcherState<TValue>>;
Defined in: batcher.ts:61
Initial state for the batcher
ts
optional key: string;
optional key: string;
Defined in: batcher.ts:66
Optional key to identify this batcher instance. If provided, the batcher will be identified by this key in the devtools and PacerProvider if applicable.
ts
optional maxSize: number;
optional maxSize: number;
Defined in: batcher.ts:71
Maximum number of items in a batch
ts
Infinity
Infinity
ts
optional onExecute: (batch, batcher) => void;
optional onExecute: (batch, batcher) => void;
Defined in: batcher.ts:75
Callback fired after a batch is processed
TValue[]
Batcher <TValue>
void
ts
optional onItemsChange: (batcher) => void;
optional onItemsChange: (batcher) => void;
Defined in: batcher.ts:79
Callback fired after items are added to the batcher
Batcher <TValue>
void
ts
optional started: boolean;
optional started: boolean;
Defined in: batcher.ts:84
Whether the batcher should start processing immediately
ts
true
true
ts
optional wait: number | (batcher) => number;
optional wait: number | (batcher) => number;
Defined in: batcher.ts:91
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
