@anfenn/zync 0.4.7 → 0.4.8
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 +8 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
Simple, unopinionated, bullet-proof, offline-first sync middleware for Zustand.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Use Case
|
|
8
|
+
|
|
9
|
+
Zync is when you want to persist and sync small amounts of state in a website or PWA. It's ideal if you know you'll never need the power of
|
|
10
|
+
sqlite or the complexity of DB schemas and relationships, and it keeps your components free from wiring-up code and allows you to use pure JS to select/sort/mutate your state.
|
|
11
|
+
|
|
12
|
+
The tradeoff however is although Zustand can use IndexedDB, it will store all state in one key, and so load it all into the JS VM.
|
|
13
|
+
|
|
14
|
+
When you need sqlite, or you know the client will need large amounts of data, [WatermelondDB](https://github.com/nozbe/WatermelonDB) is what you want. This will however require a backend that provides the PUSH/PULL endpoints for synchronising or perhaps modifying the frontend to redirect those requests to and from specific endpoints.
|
|
8
15
|
|
|
9
16
|
## Benefits
|
|
10
17
|
|
|
@@ -278,10 +285,6 @@ If you want to use the bundled `createIndexedDB()` helper, install `idb` in your
|
|
|
278
285
|
npm install idb
|
|
279
286
|
```
|
|
280
287
|
|
|
281
|
-
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.
|
|
282
|
-
|
|
283
|
-
From testing I've found Zustand and Zync are lightening fast even with 100,000 average sized state objects.
|
|
284
|
-
|
|
285
288
|
## Community
|
|
286
289
|
|
|
287
290
|
PRs are welcome! [pnpm](https://pnpm.io) is used as a package manager. Run `pnpm install` to install local dependencies. Thank you for contributing!
|