@syncular/react 0.78.0 → 0.78.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.
package/README.md CHANGED
@@ -240,7 +240,10 @@ Generated query coverage uses composable claims. Multiple consumers of the
240
240
  same window base contribute a union, and unmounting one removes only its own
241
241
  units. `useWindow(base)` remains the lower-level imperative interface for
242
242
  prefetching or dynamic query builders. Applications normally do not need it
243
- beside a generated `useQuery`.
243
+ beside a generated `useQuery`. Its `loaded` field is `false` until the first
244
+ window-state read returns; until then `units` is empty whatever the window
245
+ holds. After a reload the store keeps every held unit until one of its claims
246
+ names it, so a query's claim never evicts units the app has yet to claim.
244
247
 
245
248
  For a small known navigation working set,
246
249
  `useRetainedWindow(base, units)` prefetches and retains those units through the
@@ -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.78.0";
6
+ export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.78.2";
@@ -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 const SYNCULAR_REACT_RUNTIME_VERSION = '0.78.0';
6
+ export const SYNCULAR_REACT_RUNTIME_VERSION = '0.78.2';
@@ -2,6 +2,9 @@ import { type WindowBase } from '@syncular/client';
2
2
  export interface UseWindowResult {
3
3
  readonly units: readonly string[];
4
4
  readonly pending: readonly string[];
5
+ /** False until the first read of the window state returns; `units` is
6
+ * empty before it whatever the window holds. */
7
+ readonly loaded: boolean;
5
8
  /** Update this component's claim; the store applies the union of all claims. */
6
9
  readonly setWindow: (units: readonly string[]) => Promise<void>;
7
10
  readonly isComplete: (unit: string) => boolean;
@@ -63,6 +63,7 @@ export function useWindow(base) {
63
63
  return {
64
64
  units: state.units,
65
65
  pending: state.pending,
66
+ loaded: state.loaded,
66
67
  setWindow,
67
68
  isComplete,
68
69
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/react",
3
- "version": "0.78.0",
3
+ "version": "0.78.2",
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.78.0"
58
+ "@syncular/client": "0.78.2"
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.78.0",
66
- "@syncular/server": "0.78.0",
65
+ "@syncular/core": "0.78.2",
66
+ "@syncular/server": "0.78.2",
67
67
  "@testing-library/react": "^16.1.0",
68
68
  "@types/react": "^18.3.0",
69
69
  "@types/react-dom": "^18.3.0",
@@ -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 const SYNCULAR_REACT_RUNTIME_VERSION = '0.78.0';
6
+ export const SYNCULAR_REACT_RUNTIME_VERSION = '0.78.2';
package/src/use-window.ts CHANGED
@@ -16,6 +16,9 @@ import { useReactiveStore } from './use-client';
16
16
  export interface UseWindowResult {
17
17
  readonly units: readonly string[];
18
18
  readonly pending: readonly string[];
19
+ /** False until the first read of the window state returns; `units` is
20
+ * empty before it whatever the window holds. */
21
+ readonly loaded: boolean;
19
22
  /** Update this component's claim; the store applies the union of all claims. */
20
23
  readonly setWindow: (units: readonly string[]) => Promise<void>;
21
24
  readonly isComplete: (unit: string) => boolean;
@@ -118,6 +121,7 @@ export function useWindow(base: WindowBase): UseWindowResult {
118
121
  return {
119
122
  units: state.units,
120
123
  pending: state.pending,
124
+ loaded: state.loaded,
121
125
  setWindow,
122
126
  isComplete,
123
127
  };