File: LocalStorageCollectionUtils.md | Updated: 11/15/2025
Search...
+ K
Auto
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide
Documentation
Framework
React
Version
Latest
Search...
+ K
Menu
Getting Started
Guides
Collections
Frameworks
Community
API Reference
Framework
React
Version
Latest
Menu
Getting Started
Guides
Collections
Frameworks
Community
API Reference
On this page
Copy Markdown
Interface: LocalStorageCollectionUtils
======================================
Defined in: packages/db/src/local-storage.ts:100
LocalStorage collection utilities type
ts
[key: string]: any
[key: string]: any
Properties
----------
### acceptMutations()
ts
acceptMutations: (transaction) => void;
acceptMutations: (transaction) => void;
Defined in: packages/db/src/local-storage.ts:120
Accepts mutations from a transaction that belong to this collection and persists them to localStorage. This should be called in your transaction's mutationFn to persist local-storage data.
#### Parameters ##### transaction
The transaction containing mutations to accept
PendingMutation <Record<string, unknown>, OperationType , Collection <Record<string, unknown>, any, any, any, any>>[]
void
ts
const localSettings = createCollection(localStorageCollectionOptions({...}))
const tx = createTransaction({
mutationFn: async ({ transaction }) => {
// Make API call first
await api.save(...)
// Then persist local-storage mutations after success
localSettings.utils.acceptMutations(transaction)
}
})
const localSettings = createCollection(localStorageCollectionOptions({...}))
const tx = createTransaction({
mutationFn: async ({ transaction }) => {
// Make API call first
await api.save(...)
// Then persist local-storage mutations after success
localSettings.utils.acceptMutations(transaction)
}
})
ts
clearStorage: ClearStorageFn;
clearStorage: ClearStorageFn;
Defined in: packages/db/src/local-storage.ts:101
ts
getStorageSize: GetStorageSizeFn;
getStorageSize: GetStorageSizeFn;
Defined in: packages/db/src/local-storage.ts:102
