Skip to main content
Version: v10.0.0

TransactionConfig

A named transaction declared in createDb : one request sends all of its writes


Import
import { TransactionConfig } from "@hyper-fetch/db"

Preview​

type TransactionConfig = {
mutationFn: (context: { id: string; mutations: TransactionWrite[] }) => RequestInstance;
onSuccess?: keep | refetch;
}

Structure​

TransactionConfig
NameTypeDescription
onSuccess
keep | refetch

What happens to the changes once the request succeeds: keep makes them the server state, which is the default, and refetch reloads the loaded subsets that hold the changed rows

mutationFn
(context: { id: string; mutations: TransactionWrite[] }) => RequestInstance

Returns the request that sends the writes. The transaction id is an idempotency key.