@anfenn/zync 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -242,23 +242,19 @@ async function firstLoad(lastId: any) {
|
|
|
242
242
|
|
|
243
243
|
## Optional IndexedDB storage
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
Using async IndexedDB over sync localStorage gives the advantage of a responsive UI when reading/writing a very large store, as IndexedDB is running in it's own thread.
|
|
246
246
|
|
|
247
247
|
If you want to use the bundled `createIndexedDBStorage()` helper, install `idb` in your project. It's intentionally optional so projects that don't use IndexedDB won't pull the dependency into their bundles.
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
[idb](https://www.npmjs.com/package/idb) is an extremely popular and lightweight wrapper to simplify IndexedDB's verbose events based api into a simple Promise based one. It also handles the inconsistencies found when running in different browsers.
|
|
250
250
|
|
|
251
251
|
```bash
|
|
252
252
|
npm install idb
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
npm install --save-optional idb
|
|
259
|
-
```
|
|
255
|
+
When using IndexedDB Zustand saves the whole store under one key, which means indexes cannot be used to accelerate querying. However, if this becomes a performance issue due to the size of the store, then libraries like dexie.js instead of Zustand would be a better solution and provide the syntax for high performance queries.
|
|
260
256
|
|
|
261
|
-
|
|
257
|
+
From testing I've found Zustand and Zync are lightening fast even with 100,000 average sized state objects.
|
|
262
258
|
|
|
263
259
|
## Community
|
|
264
260
|
|