@molecule/app-react-native 3.0.4 → 3.0.5
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 +15 -2
- package/package.json +2 -2
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-
|
|
6
|
+
Generated: 2026-11-06T02:49:48.362Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-react-native
|
|
@@ -3292,7 +3292,8 @@ const useAsyncState: <T>(initialState: T) => [T, AsyncSetState<T>, AsyncExtendSt
|
|
|
3292
3292
|
|
|
3293
3293
|
A server-backed value — a favorite, follow, like or bookmark button, a rating, a quantity, a
|
|
3294
3294
|
setting switch — that changes on the first render after a tap and is saved one change at a
|
|
3295
|
-
time, in order.
|
|
3295
|
+
time, in order. Taps during a save update the desired value; the newest waiting value is
|
|
3296
|
+
saved after it (intermediate waiting values coalesce). Only a failure of the newest
|
|
3296
3297
|
change puts the server value back. See `createOptimisticValue` in `@molecule/app-state`.
|
|
3297
3298
|
|
|
3298
3299
|
`value` is the server's value from props or a query. A new `value` is taken only when it
|
|
@@ -3300,6 +3301,18 @@ differs (by `equals`) from the one the hook last received, and only while nothin
|
|
|
3300
3301
|
saved, so a parent re-render or a refetch of older data never flips the button mid-save. The
|
|
3301
3302
|
latest `commit` and `onError` are always used. Give the component a `key` per record, so one
|
|
3302
3303
|
record's pending change never shows on another.
|
|
3304
|
+
Keep related fields, such as a favorite flag and its count, in the SAME value. Return both
|
|
3305
|
+
from the server response in `commit`, and publish that response to parent/query caches there
|
|
3306
|
+
if needed. Let commit reject on failure: a catch that returns old data hides the failure.
|
|
3307
|
+
Replace display-state setters and prop-copy effects with this hook's value and `update`.
|
|
3308
|
+
`pending` is for feedback, never a reason to disable the toggle or drop a tap.
|
|
3309
|
+
|
|
3310
|
+
Render/enable the keyed control only once its initial record exists. Keep that control
|
|
3311
|
+
mounted through refetches of the same record. This hook does not fix a click handler that
|
|
3312
|
+
returns on a still-null profile, or a remount that throws its controller away. Refetches
|
|
3313
|
+
during a save cannot replace pending intent; changed server snapshots arriving AFTER saving
|
|
3314
|
+
finishes are accepted and need query-layer ordering if they can be stale. See the module
|
|
3315
|
+
quickstart for a complete favorite button with a server-confirmed count.
|
|
3303
3316
|
|
|
3304
3317
|
```typescript
|
|
3305
3318
|
const useOptimisticValue: <T>(options: OptimisticValueOptions<T>) => UseOptimisticValueResult<T>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-react-native",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "React Native framework bindings for molecule.dev",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-react-native",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"directory": "packages/app/frameworks/react-native"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@molecule/app-react": "3.4.
|
|
36
|
+
"@molecule/app-react": "3.4.1",
|
|
37
37
|
"@types/node": "26.6.5",
|
|
38
38
|
"react": "19.3.1",
|
|
39
39
|
"typescript": "6.0.3",
|