本页还没有译文
本页 21 段还没译成日本語,下面显示的是英文原文。setStateSlice
还没翻译译自英文(tanstack.com)本页 21 段都还没译
function setStateSlice<K>(
instance,
key,
updater,
isEqual?): void;Defined in: utils.ts:223
Routes a state slice update through the slice's on<State>Change handler,
preserving the owner's current reference for structural no-ops.
Equality is evaluated inside the updater received by the state owner, never against the table's potentially stale controlled snapshot. This keeps same-tick updates composable in queued host containers such as React state, evaluates the original updater only when the owner applies it, and lets atom owners suppress notifications by returning their existing reference.
A user-provided change handler is still invoked for a no-op because only that handler's state container can know its latest queued value. The guarded updater returns that container's previous reference, preventing a state write or render in state containers with identity bailout semantics.
Hot-path slices that skip guarding entirely (selection maps that scale with
row count, pointer-frequency resize state) call their change handler
directly instead of routing through this util. Custom feature slices with a
cheaper or semantic-aware comparison can pass isEqual to override the
structural default.
Type Parameters
K
K extends keyof TableState_All | string & object
Parameters
instance
options
object
key
K
updater
Updater<StateSliceForKey<K>>
isEqual?
StateSliceEqualityFn<StateSliceForKey<K>> = stateSlicesEqual
Returns
void