Defined in: packages/db/src/local-storage.ts:102
LocalStorage collection utilities type
[key: string]: anyacceptMutations: (transaction) => Promise<void>;Defined in: packages/db/src/local-storage.ts:122
Accepts mutations from a transaction that belong to this collection and persists them to localStorage. Call this in your transaction's mutationFn. Its persistence receipt follows the storage write even if the returned Promise is not awaited. Await it when later mutationFn work depends on the write.
The transaction containing mutations to accept
PendingMutation<Record<string, unknown>, OperationType, Collection<Record<string, unknown>, any, any, any, any>>[]
Promise<void>
const localSettings = createCollection(localStorageCollectionOptions({...}))
const tx = createTransaction({
mutationFn: async ({ transaction }) => {
// Make API call first
await api.save(...)
// Then persist local-storage mutations after success
await localSettings.utils.acceptMutations(transaction)
}
})clearStorage: ClearStorageFn;Defined in: packages/db/src/local-storage.ts:103
getStorageSize: GetStorageSizeFn;Defined in: packages/db/src/local-storage.ts:104