Defined in: packages/db/src/local-only.ts:40
Local-only collection utilities type
[key: string]: any
[key: string]: any
acceptMutations: (transaction) => void;
acceptMutations: (transaction) => void;
Defined in: packages/db/src/local-only.ts:58
Accepts mutations from a transaction that belong to this collection and persists them. This should be called in your transaction's mutationFn to persist local-only data.
The transaction containing mutations to accept
PendingMutation<Record<string, unknown>, OperationType, Collection<Record<string, unknown>, any, any, any, any>>[]
void
const localData = createCollection(localOnlyCollectionOptions({...}))
const tx = createTransaction({
mutationFn: async ({ transaction }) => {
// Make API call first
await api.save(...)
// Then persist local-only mutations after success
localData.utils.acceptMutations(transaction)
}
})
const localData = createCollection(localOnlyCollectionOptions({...}))
const tx = createTransaction({
mutationFn: async ({ transaction }) => {
// Make API call first
await api.save(...)
// Then persist local-only mutations after success
localData.utils.acceptMutations(transaction)
}
})
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
