@syncular/react 0.67.3 → 0.68.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.
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Vite HMR uses it to replace a worker owner after a Syncular package upgrade
|
|
4
4
|
* even when the application's generated schema version did not change.
|
|
5
5
|
*/
|
|
6
|
-
export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.
|
|
6
|
+
export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.68.0";
|
package/dist/runtime-version.js
CHANGED
package/dist/use-window.js
CHANGED
|
@@ -38,7 +38,9 @@ export function useRetainedWindow(base, units) {
|
|
|
38
38
|
});
|
|
39
39
|
return () => {
|
|
40
40
|
active = false;
|
|
41
|
-
|
|
41
|
+
// An unmounted component has nowhere to show a failed release; the next
|
|
42
|
+
// claim on the base applies it again.
|
|
43
|
+
retention.release().catch(() => { });
|
|
42
44
|
};
|
|
43
45
|
}, [stableBase, stableUnits, store]);
|
|
44
46
|
return state;
|
|
@@ -53,7 +55,9 @@ export function useWindow(base) {
|
|
|
53
55
|
const stableBase = useMemo(() => base, [baseIdentity]);
|
|
54
56
|
const entry = useMemo(() => store.window(stableBase), [store, stableBase]);
|
|
55
57
|
const state = useSyncExternalStore(entry.subscribe, entry.getSnapshot, entry.getSnapshot);
|
|
56
|
-
useEffect(() => () =>
|
|
58
|
+
useEffect(() => () => {
|
|
59
|
+
store.releaseWindowClaims(owner.current).catch(() => { });
|
|
60
|
+
}, [stableBase, store]);
|
|
57
61
|
const setWindow = useCallback((units) => store.setWindowClaim(owner.current, stableBase, units), [stableBase, store]);
|
|
58
62
|
const isComplete = useCallback((unit) => windowComplete(state, unit), [state]);
|
|
59
63
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"description": "React hooks for Syncular offline-first sync",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"test": "bun test --preload ./test/setup.ts"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@syncular/client": "0.
|
|
58
|
+
"@syncular/client": "0.68.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"react": ">=18.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@happy-dom/global-registrator": "^20.0.0",
|
|
65
|
-
"@syncular/core": "0.
|
|
66
|
-
"@syncular/server": "0.
|
|
65
|
+
"@syncular/core": "0.68.0",
|
|
66
|
+
"@syncular/server": "0.68.0",
|
|
67
67
|
"@testing-library/react": "^16.1.0",
|
|
68
68
|
"@types/react": "^18.3.0",
|
|
69
69
|
"@types/react-dom": "^18.3.0",
|
package/src/runtime-version.ts
CHANGED
package/src/use-window.ts
CHANGED
|
@@ -75,7 +75,9 @@ export function useRetainedWindow(
|
|
|
75
75
|
);
|
|
76
76
|
return () => {
|
|
77
77
|
active = false;
|
|
78
|
-
|
|
78
|
+
// An unmounted component has nowhere to show a failed release; the next
|
|
79
|
+
// claim on the base applies it again.
|
|
80
|
+
retention.release().catch(() => {});
|
|
79
81
|
};
|
|
80
82
|
}, [stableBase, stableUnits, store]);
|
|
81
83
|
|
|
@@ -98,7 +100,9 @@ export function useWindow(base: WindowBase): UseWindowResult {
|
|
|
98
100
|
);
|
|
99
101
|
|
|
100
102
|
useEffect(
|
|
101
|
-
() => () =>
|
|
103
|
+
() => () => {
|
|
104
|
+
store.releaseWindowClaims(owner.current).catch(() => {});
|
|
105
|
+
},
|
|
102
106
|
[stableBase, store],
|
|
103
107
|
);
|
|
104
108
|
|