CreateOptimisticActionsOptions

Interface: CreateOptimisticActionsOptions<TVars, T>

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

Options for the createOptimisticAction helper

Extends

Type Parameters

TVars

TVars = unknown

T

T extends object = Record<string, unknown>

Properties

autoCommit?

ts
optional autoCommit: boolean;
optional autoCommit: boolean;

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

Inherited from

TransactionConfig.autoCommit


id?

ts
optional id: string;
optional id: string;

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

Unique identifier for the transaction

Inherited from

ts
Omit.id
Omit.id

metadata?

ts
optional metadata: Record<string, unknown>;
optional metadata: Record<string, unknown>;

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

Custom metadata to associate with the transaction

Inherited from

ts
Omit.metadata
Omit.metadata

mutationFn()

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

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

Function to execute the mutation on the server

Parameters

vars

TVars

params

MutationFnParams<T>

Returns

Promise<any>


onMutate()

ts
onMutate: (vars) => void;
onMutate: (vars) => void;

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

Function to apply optimistic updates locally before the mutation completes

Parameters

vars

TVars

Returns

void

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.