@molecule/app-react 3.3.1 → 3.4.0

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 CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-04T14:20:06.747Z
6
+ Generated: 2026-11-05T08:55:37.068Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-react
@@ -3326,7 +3326,7 @@ Peer dependencies:
3326
3326
  - `@molecule/app-i18n` ^1.0.1
3327
3327
  - `@molecule/app-logger` ^1.0.1
3328
3328
  - `@molecule/app-routing` ^1.0.1
3329
- - `@molecule/app-state` ^1.1.0
3329
+ - `@molecule/app-state` ^1.2.0
3330
3330
  - `@molecule/app-storage` ^1.0.1
3331
3331
  - `@molecule/app-theme` ^1.0.1
3332
3332
  - `@molecule/app-ui` ^1.0.1
@@ -3364,6 +3364,10 @@ Peer dependencies:
3364
3364
  - `@molecule/app-version`
3365
3365
  - `react`
3366
3366
 
3367
+ - Server-backed switches and counters use `useOptimisticValue`. When one commit saves
3368
+ several records, call its third argument after each accepted request:
3369
+ `confirm((current) => ({ ...current, [id]: saved }))`, then return nothing. A later
3370
+ rejection keeps those accepted records while rolling back the unsaved changes.
3367
3371
  - `useProfileForm` needs `AuthProvider` (or `MoleculeProvider auth={client}`)
3368
3372
  and uses the bonded forms provider, just like `useForm`. `defaultValues`
3369
3373
  and `toValues` must cover every registered control; map nullable text to
@@ -61,7 +61,7 @@ export const useOptimisticValue = (options) => {
61
61
  });
62
62
  const [controller] = useState(() => createOptimisticValue({
63
63
  value: options.value,
64
- commit: (next, previous) => latest.current.commit(next, previous),
64
+ commit: (next, previous, confirm) => latest.current.commit(next, previous, confirm),
65
65
  equals: (a, b) => (latest.current.equals ?? shallowEqual)(a, b),
66
66
  onError: (error, value) => latest.current.onError?.(error, value),
67
67
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"useOptimisticValue.js","sourceRoot":"","sources":["../../src/hooks/useOptimisticValue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAG7F,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAqBzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAkC,EACL,EAAE;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;IAC9B,mFAAmF;IACnF,uFAAuF;IACvF,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CACjC,qBAAqB,CAAI;QACvB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;QACjE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;KAClE,CAAC,CACH,CAAA;IAED,MAAM,QAAQ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AAA"}
package/dist/index.d.ts CHANGED
@@ -90,6 +90,10 @@
90
90
  * ```
91
91
  *
92
92
  * @remarks
93
+ * - Server-backed switches and counters use `useOptimisticValue`. When one commit saves
94
+ * several records, call its third argument after each accepted request:
95
+ * `confirm((current) => ({ ...current, [id]: saved }))`, then return nothing. A later
96
+ * rejection keeps those accepted records while rolling back the unsaved changes.
93
97
  * - `useProfileForm` needs `AuthProvider` (or `MoleculeProvider auth={client}`)
94
98
  * and uses the bonded forms provider, just like `useForm`. `defaultValues`
95
99
  * and `toValues` must cover every registered control; map nullable text to
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6KG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiLG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -90,6 +90,10 @@
90
90
  * ```
91
91
  *
92
92
  * @remarks
93
+ * - Server-backed switches and counters use `useOptimisticValue`. When one commit saves
94
+ * several records, call its third argument after each accepted request:
95
+ * `confirm((current) => ({ ...current, [id]: saved }))`, then return nothing. A later
96
+ * rejection keeps those accepted records while rolling back the unsaved changes.
93
97
  * - `useProfileForm` needs `AuthProvider` (or `MoleculeProvider auth={client}`)
94
98
  * and uses the bonded forms provider, just like `useForm`. `defaultValues`
95
99
  * and `toValues` must cover every registered control; map nullable text to
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6KG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiLG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-react",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "React framework bindings for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "@molecule/app-i18n": "^1.0.1",
32
32
  "@molecule/app-logger": "^1.0.1",
33
33
  "@molecule/app-routing": "^1.0.1",
34
- "@molecule/app-state": "^1.1.0",
34
+ "@molecule/app-state": "^1.2.0",
35
35
  "@molecule/app-storage": "^1.0.1",
36
36
  "@molecule/app-theme": "^1.0.1",
37
37
  "@molecule/app-ui": "^1.0.1",