Skip to main content

CreateOptimisticActionsOptions

还没翻译译自英文(tanstack.com)本页 43 段都还没译

Defined in: packages/db/src/types.ts:202

Options for the createOptimisticAction helper

Extends

Type Parameters

TVars

TVars = unknown

T

T extends object = Record<string, unknown>

Properties

autoCommit?

optional autoCommit: boolean;

Defined in: packages/db/src/types.ts:193

Inherited from

TransactionConfig.autoCommit


id?

optional id: string;

Defined in: packages/db/src/types.ts:191

Unique identifier for the transaction

Inherited from

TransactionConfig.id


metadata?

optional metadata: Record<string, unknown>;

Defined in: packages/db/src/types.ts:196

Custom metadata to associate with the transaction

Inherited from

TransactionConfig.metadata


mutationFn()

mutationFn: (vars, params) => Promise<any>;

Defined in: packages/db/src/types.ts:209

Function to execute the mutation on the server

Parameters

vars

TVars

params

MutationFnParams<T>

Returns

Promise<any>


onMutate()

onMutate: (vars) => void;

Defined in: packages/db/src/types.ts:207

Function to apply optimistic updates locally before the mutation completes

Parameters

vars

TVars

Returns

void