Skip to main content

SolidBatcher

Defined in: batcher/createBatcher.ts:22

Extends

  • Omit<Batcher<TValue>, "store">

Type Parameters

TValue

TValue

TSelected

TSelected = { }

Properties

options

options: Omit<Required<BatcherOptions<TValue>>, "initialState" | "key" | "onItemsChange" | "onExecute"> & Partial<Pick<Required<BatcherOptions<TValue>>, "initialState" | "key" | "onItemsChange" | "onExecute">> & SolidBatcherOptions<TValue, TSelected>;

Defined in: batcher/createBatcher.ts:26

Overrides

Omit.options

setOptions

setOptions: (options) => void;

Defined in: batcher/createBatcher.ts:27

Updates the batcher options

Parameters

options

Partial<SolidBatcherOptions<TValue, TSelected>>

Returns

void

Overrides

Omit.setOptions

state

readonly state: Accessor<Readonly<TSelected>>;

Defined in: batcher/createBatcher.ts:51

Reactive state that will be updated when the batcher state changes

Use this instead of batcher.store.state


store

readonly store: Store<Readonly<BatcherState<TValue>>>;

Defined in: batcher/createBatcher.ts:57

Deprecated

Use batcher.state instead of batcher.store.state if you want to read reactive state. The state on the store object is not reactive, as it has not been wrapped in a useSelector hook internally. Although, you can make the state reactive by using the useSelector in your own usage.


Subscribe

Subscribe: <TSelected>(props) => Element;

Defined in: batcher/createBatcher.ts:42

A Solid component that allows you to subscribe to the batcher state.

This is useful for tracking specific parts of the batcher state deep in your component tree without needing to pass a selector to the hook.

Type Parameters

TSelected

TSelected

Parameters

props
children

Element | ((state) => Element)

selector

(state) => TSelected

Returns

Element

Example

<batcher.Subscribe selector={(state) => ({ size: state.size, isPending: state.isPending })}>
  {(state) => (
    <div>Batch: {state().size} items, {state().isPending ? 'Pending' : 'Idle'}</div>
  )}
</batcher.Subscribe>