Skip to content

Commit ae46fd3

Browse files
committed
[indexed-db] Document mergeable support
1 parent ebde82f commit ae46fd3

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

site/guides/08_synchronization/1_using_a_mergeablestore.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ The following Persister types _can_ be used to persist a MergeableStore:
109109
| SessionPersister | Browser session storage |
110110
| LocalPersister | Browser local storage |
111111
| OpfsPersister | Browser origin private file system (OPFS) |
112+
| IndexedDbPersister | Browser IndexedDB |
112113
| FilePersister | Local file (where possible) |
113114
| ReactNativeMmkvPersister | MMKV in React Native, via [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv) |
114115

@@ -132,7 +133,6 @@ persist a MergeableStore:
132133

133134
| Persister | Storage |
134135
| --------------------- | ---------------------------------------------------------------------------------------- |
135-
| IndexedDbPersister | Browser IndexedDB |
136136
| RemotePersister | Remote server |
137137
| CrSqliteWasmPersister | SQLite CRDTs, via [cr-sqlite-wasm](https://github.com/vlcn-io/cr-sqlite) |
138138
| ElectricSqlPersister | Electric SQL, via [electric-sql](https://github.com/electric-sql/electric) |

site/guides/20_releases.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,29 @@ policies up yourself, in a migration or the Supabase SQL editor, and it stays
104104
exactly as you left it. If you would rather have a Persister that manages its
105105
own schema, use the new PgPersister against a direct connection instead.
106106

107+
## MergeableStore Support For IndexedDB
108+
109+
The IndexedDbPersister can now persist a MergeableStore, closing a gap that had
110+
made IndexedDB the odd one out amongst the browser Persisters (as requested in
111+
issue [#203](https://github.com/tinyplex/tinybase/issues/203)). The
112+
SessionPersister, LocalPersister and OpfsPersister could all already do this; now
113+
the browser's most capable storage can too.
114+
115+
```js ignore
116+
import {createMergeableStore} from 'tinybase';
117+
import {createIndexedDbPersister} from 'tinybase/persisters/persister-indexed-db';
118+
119+
const store = createMergeableStore().setTables({pets: {fido: {species: 'dog'}}});
120+
const persister = createIndexedDbPersister(store, 'petStore');
121+
122+
await persister.save();
123+
```
124+
125+
A regular Store continues to use the 't' and 'v' object stores exactly as
126+
before. A MergeableStore uses a new one called 'm', so the two formats live
127+
alongside each other rather than one replacing the other, and databases written
128+
by previous versions are upgraded in place with their content intact.
129+
107130
---
108131

109132
# v9.5

0 commit comments

Comments
 (0)