supastash 0.1.16 → 0.1.17

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.
@@ -15,5 +15,5 @@ import { SupastashHookReturn } from "../types/supastashConfig.types";
15
15
  * stopSync: () => void
16
16
  * }} Object containing the DB readiness state and sync control functions.
17
17
  */
18
- export declare function useSupastash(): SupastashHookReturn;
18
+ export declare function useSupastash(lazy?: boolean): SupastashHookReturn;
19
19
  //# sourceMappingURL=supastashLogic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"supastashLogic.d.ts","sourceRoot":"","sources":["../../src/hooks/supastashLogic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAQrE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,IAAI,mBAAmB,CAsElD"}
1
+ {"version":3,"file":"supastashLogic.d.ts","sourceRoot":"","sources":["../../src/hooks/supastashLogic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAQrE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,IAAI,GAAE,OAAe,GAAG,mBAAmB,CAuEvE"}
@@ -21,7 +21,7 @@ import { supabaseClientErr } from "../utils/supabaseClientErr";
21
21
  * stopSync: () => void
22
22
  * }} Object containing the DB readiness state and sync control functions.
23
23
  */
24
- export function useSupastash() {
24
+ export function useSupastash(lazy = false) {
25
25
  const [dbReady, setDbReady] = useState(false);
26
26
  const initialized = useRef(false);
27
27
  const config = getSupastashConfig();
@@ -70,6 +70,8 @@ export function useSupastash() {
70
70
  };
71
71
  }, []);
72
72
  useEffect(() => {
73
+ if (lazy)
74
+ return;
73
75
  if (dbReady) {
74
76
  try {
75
77
  startSync();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supastash",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",