@pylonsync/react 0.3.179 → 0.3.181
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/package.json +3 -3
- package/src/hooks.ts +17 -5
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.181",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "src/index.ts",
|
|
9
9
|
"types": "src/index.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"check": "tsc -p tsconfig.json --noEmit"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@pylonsync/sdk": "0.3.
|
|
16
|
-
"@pylonsync/sync": "0.3.
|
|
15
|
+
"@pylonsync/sdk": "0.3.181",
|
|
16
|
+
"@pylonsync/sync": "0.3.181"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=19.0.0"
|
package/src/hooks.ts
CHANGED
|
@@ -493,11 +493,23 @@ export function useMutation<TArgs = Record<string, unknown>, TResult = unknown>(
|
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
try {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
)
|
|
496
|
+
// Route through SyncEngine.fn when one is wired so the response's
|
|
497
|
+
// X-Pylon-Change-Seq triggers a fallback pull if the WS broadcast
|
|
498
|
+
// hasn't landed yet. Falling back to the free callFn for hooks
|
|
499
|
+
// wired without a sync engine (rare — only legacy non-React-init
|
|
500
|
+
// callers) keeps backwards compatibility, but apps using
|
|
501
|
+
// useMutation in the normal `init()` flow now match db.fn's
|
|
502
|
+
// change-seq behavior.
|
|
503
|
+
const result = sync
|
|
504
|
+
? await sync.fn<TResult>(
|
|
505
|
+
fnName,
|
|
506
|
+
serverArgs as Record<string, unknown>,
|
|
507
|
+
)
|
|
508
|
+
: await callFn<TResult>(
|
|
509
|
+
fnName,
|
|
510
|
+
serverArgs as Record<string, unknown>,
|
|
511
|
+
{ token: tokenRef.current },
|
|
512
|
+
);
|
|
501
513
|
if (mounted.current) setData(result);
|
|
502
514
|
return result;
|
|
503
515
|
} catch (e) {
|