@nkzw/fate-indexeddb 1.10.1 → 1.10.2

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.
Files changed (2) hide show
  1. package/README.md +9 -1
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1311,6 +1311,14 @@ addComment({
1311
1311
 
1312
1312
  The server returns the selected fields, and views that display the post's comment count update automatically.
1313
1313
 
1314
+ Use `.with()` before `useActionState` to include selected fields in `state.result`:
1315
+
1316
+ ```tsx
1317
+ const [state, addComment] = useActionState(fate.actions.comment.add.with(CommentView), null);
1318
+ ```
1319
+
1320
+ Pass a view or a raw selection. Chaining `.with()` adds fields to the existing selection, for example `.with(CommentView).with({ post: { commentCount: true } })`.
1321
+
1314
1322
  ### Mutations
1315
1323
 
1316
1324
  Use `fate.mutations` to call a mutation outside a React Action, or when calls should run without waiting for earlier actions to finish:
@@ -2377,7 +2385,7 @@ if (result) {
2377
2385
  }
2378
2386
  ```
2379
2387
 
2380
- Without a selection, entity results expose only identity fields. React clients can also use `fate.actions` with `useActionState`; those action results expose identity fields, while selected fields update the cache for views to read.
2388
+ Without a selection, entity results expose only identity fields. For React Actions, use [`.with()`](/docs/guide/actions.md#selecting-a-view-with-actions) to select additional fields.
2381
2389
 
2382
2390
  For mappings without a schema, use `graphqlMutation` from `@nkzw/fate` to declare mutation types manually.
2383
2391
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nkzw/fate-indexeddb",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Optional IndexedDB persistence adapter for fate.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "idb": "^8.0.4"
20
20
  },
21
21
  "devDependencies": {
22
- "@nkzw/fate": "1.10.1",
22
+ "@nkzw/fate": "1.10.2",
23
23
  "fake-indexeddb": "^6.2.6",
24
24
  "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
25
25
  "vite-plus": "1.3.0"