@tanstack/preact-query-persist-client 5.103.3 → 5.104.1

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.
@@ -6,14 +6,14 @@ let preact_jsx_runtime = require("preact/jsx-runtime");
6
6
  //#region src/PersistQueryClientProvider.tsx
7
7
  const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onError, ...props }) => {
8
8
  const [isRestoring, setIsRestoring] = (0, preact_hooks.useState)(true);
9
- const refs = (0, preact_hooks.useRef)({
9
+ const optionsRef = (0, preact_hooks.useRef)({
10
10
  persistOptions,
11
11
  onSuccess,
12
12
  onError
13
13
  });
14
- const didRestore = (0, preact_hooks.useRef)(false);
14
+ const didRestoreRef = (0, preact_hooks.useRef)(false);
15
15
  (0, preact_hooks.useEffect)(() => {
16
- refs.current = {
16
+ optionsRef.current = {
17
17
  persistOptions,
18
18
  onSuccess,
19
19
  onError
@@ -21,17 +21,17 @@ const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onErr
21
21
  });
22
22
  (0, preact_hooks.useEffect)(() => {
23
23
  const options = {
24
- ...refs.current.persistOptions,
24
+ ...optionsRef.current.persistOptions,
25
25
  queryClient: props.client
26
26
  };
27
- if (!didRestore.current) {
28
- didRestore.current = true;
27
+ if (!didRestoreRef.current) {
28
+ didRestoreRef.current = true;
29
29
  (0, _tanstack_query_persist_client_core.persistQueryClientRestore)(options).then(() => {
30
- var _refs$current$onSucce, _refs$current;
31
- return (_refs$current$onSucce = (_refs$current = refs.current).onSuccess) === null || _refs$current$onSucce === void 0 ? void 0 : _refs$current$onSucce.call(_refs$current);
30
+ var _optionsRef$current$o, _optionsRef$current;
31
+ return (_optionsRef$current$o = (_optionsRef$current = optionsRef.current).onSuccess) === null || _optionsRef$current$o === void 0 ? void 0 : _optionsRef$current$o.call(_optionsRef$current);
32
32
  }).catch(() => {
33
- var _refs$current$onError, _refs$current2;
34
- return (_refs$current$onError = (_refs$current2 = refs.current).onError) === null || _refs$current$onError === void 0 ? void 0 : _refs$current$onError.call(_refs$current2);
33
+ var _optionsRef$current$o2, _optionsRef$current2;
34
+ return (_optionsRef$current$o2 = (_optionsRef$current2 = optionsRef.current).onError) === null || _optionsRef$current$o2 === void 0 ? void 0 : _optionsRef$current$o2.call(_optionsRef$current2);
35
35
  }).finally(() => {
36
36
  setIsRestoring(false);
37
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.cjs","names":["useState","useRef","persistQueryClientSubscribe","QueryClientProvider","IsRestoringProvider"],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const refs = useRef({ persistOptions, onSuccess, onError })\n const didRestore = useRef(false)\n\n useEffect(() => {\n refs.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...refs.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestore.current) {\n didRestore.current = true\n persistQueryClientRestore(options)\n .then(() => refs.current.onSuccess?.())\n .catch(() => refs.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,mBAAA,GAAkBA,aAAAA,SAAAA,CAAS,IAAI;CACnD,MAAM,QAAA,GAAOC,aAAAA,OAAAA,CAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAC1D,MAAM,cAAA,GAAaA,aAAAA,OAAAA,CAAO,KAAK;CAE/B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,KAAK,UAAU;GAAE;GAAgB;GAAW;EAAQ;CACtD,CAAC;CAED,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,MAAM,UAAU;GACd,GAAG,KAAK,QAAQ;GAChB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,WAAW,SAAS;GACvB,WAAW,UAAU;GACrB,CAAA,GAAA,oCAAA,0BAAA,CAA0B,OAAO,CAAC,CAC/B,WAAW;;IAAK,QAAA,yBAAA,gBAAA,KAAA,QAAA,CAAQ,eAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAA,KAAA,aAAY;GAAC,CAAA,CAAC,CACtC,YAAY;;IAAK,QAAA,yBAAA,iBAAA,KAAA,QAAA,CAAQ,aAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAA,KAAA,cAAU;GAAC,CAAA,CAAC,CACrC,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,KAAA,GAAYC,oCAAAA,4BAAAA,CAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;EAAqB,GAAI;EACvB,UAAA,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
1
+ {"version":3,"file":"PersistQueryClientProvider.cjs","names":["useState","useRef","persistQueryClientSubscribe","QueryClientProvider","IsRestoringProvider"],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const optionsRef = useRef({ persistOptions, onSuccess, onError })\n const didRestoreRef = useRef(false)\n\n useEffect(() => {\n optionsRef.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...optionsRef.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestoreRef.current) {\n didRestoreRef.current = true\n persistQueryClientRestore(options)\n .then(() => optionsRef.current.onSuccess?.())\n .catch(() => optionsRef.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,mBAAA,GAAkBA,aAAAA,SAAAA,CAAS,IAAI;CACnD,MAAM,cAAA,GAAaC,aAAAA,OAAAA,CAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAChE,MAAM,iBAAA,GAAgBA,aAAAA,OAAAA,CAAO,KAAK;CAElC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,WAAW,UAAU;GAAE;GAAgB;GAAW;EAAQ;CAC5D,CAAC;CAED,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,MAAM,UAAU;GACd,GAAG,WAAW,QAAQ;GACtB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,cAAc,SAAS;GAC1B,cAAc,UAAU;GACxB,CAAA,GAAA,oCAAA,0BAAA,CAA0B,OAAO,CAAC,CAC/B,WAAW;;IAAW,QAAA,yBAAA,sBAAA,WAAA,QAAA,CAAQ,eAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAA,KAAA,mBAAY;GAAC,CAAA,CAAC,CAC5C,YAAY;;IAAW,QAAA,0BAAA,uBAAA,WAAA,QAAA,CAAQ,aAAA,QAAA,2BAAA,KAAA,IAAA,KAAA,IAAA,uBAAA,KAAA,oBAAU;GAAC,CAAA,CAAC,CAC3C,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,KAAA,GAAYC,oCAAAA,4BAAAA,CAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;EAAqB,GAAI;EACvB,UAAA,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
@@ -2,12 +2,11 @@ import { VNode } from "preact";
2
2
  import { PersistQueryClientOptions } from "@tanstack/query-persist-client-core";
3
3
  import { OmitKeyof, QueryClientProviderProps } from "@tanstack/preact-query";
4
4
  //#region src/PersistQueryClientProvider.d.ts
5
- type PersistQueryClientProviderProps = QueryClientProviderProps & {
5
+ export type PersistQueryClientProviderProps = QueryClientProviderProps & {
6
6
  persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
7
7
  onSuccess?: () => Promise<unknown> | unknown;
8
8
  onError?: () => Promise<unknown> | unknown;
9
9
  };
10
- declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
10
+ export declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
11
11
  //#endregion
12
- export { PersistQueryClientProvider, PersistQueryClientProviderProps };
13
12
  //# sourceMappingURL=PersistQueryClientProvider.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.d.cts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;KAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;cAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
1
+ {"version":3,"file":"PersistQueryClientProvider.d.cts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;YAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;qBAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
@@ -2,12 +2,11 @@ import { PersistQueryClientOptions } from "@tanstack/query-persist-client-core";
2
2
  import { OmitKeyof, QueryClientProviderProps } from "@tanstack/preact-query";
3
3
  import { VNode } from "preact";
4
4
  //#region src/PersistQueryClientProvider.d.ts
5
- type PersistQueryClientProviderProps = QueryClientProviderProps & {
5
+ export type PersistQueryClientProviderProps = QueryClientProviderProps & {
6
6
  persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
7
7
  onSuccess?: () => Promise<unknown> | unknown;
8
8
  onError?: () => Promise<unknown> | unknown;
9
9
  };
10
- declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
10
+ export declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
11
11
  //#endregion
12
- export { PersistQueryClientProvider, PersistQueryClientProviderProps };
13
12
  //# sourceMappingURL=PersistQueryClientProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.d.ts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;KAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;cAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
1
+ {"version":3,"file":"PersistQueryClientProvider.d.ts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;YAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;qBAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
@@ -5,14 +5,14 @@ import { jsx } from "preact/jsx-runtime";
5
5
  //#region src/PersistQueryClientProvider.tsx
6
6
  const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onError, ...props }) => {
7
7
  const [isRestoring, setIsRestoring] = useState(true);
8
- const refs = useRef({
8
+ const optionsRef = useRef({
9
9
  persistOptions,
10
10
  onSuccess,
11
11
  onError
12
12
  });
13
- const didRestore = useRef(false);
13
+ const didRestoreRef = useRef(false);
14
14
  useEffect(() => {
15
- refs.current = {
15
+ optionsRef.current = {
16
16
  persistOptions,
17
17
  onSuccess,
18
18
  onError
@@ -20,17 +20,17 @@ const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onErr
20
20
  });
21
21
  useEffect(() => {
22
22
  const options = {
23
- ...refs.current.persistOptions,
23
+ ...optionsRef.current.persistOptions,
24
24
  queryClient: props.client
25
25
  };
26
- if (!didRestore.current) {
27
- didRestore.current = true;
26
+ if (!didRestoreRef.current) {
27
+ didRestoreRef.current = true;
28
28
  persistQueryClientRestore(options).then(() => {
29
- var _refs$current$onSucce, _refs$current;
30
- return (_refs$current$onSucce = (_refs$current = refs.current).onSuccess) === null || _refs$current$onSucce === void 0 ? void 0 : _refs$current$onSucce.call(_refs$current);
29
+ var _optionsRef$current$o, _optionsRef$current;
30
+ return (_optionsRef$current$o = (_optionsRef$current = optionsRef.current).onSuccess) === null || _optionsRef$current$o === void 0 ? void 0 : _optionsRef$current$o.call(_optionsRef$current);
31
31
  }).catch(() => {
32
- var _refs$current$onError, _refs$current2;
33
- return (_refs$current$onError = (_refs$current2 = refs.current).onError) === null || _refs$current$onError === void 0 ? void 0 : _refs$current$onError.call(_refs$current2);
32
+ var _optionsRef$current$o2, _optionsRef$current2;
33
+ return (_optionsRef$current$o2 = (_optionsRef$current2 = optionsRef.current).onError) === null || _optionsRef$current$o2 === void 0 ? void 0 : _optionsRef$current$o2.call(_optionsRef$current2);
34
34
  }).finally(() => {
35
35
  setIsRestoring(false);
36
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.js","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const refs = useRef({ persistOptions, onSuccess, onError })\n const didRestore = useRef(false)\n\n useEffect(() => {\n refs.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...refs.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestore.current) {\n didRestore.current = true\n persistQueryClientRestore(options)\n .then(() => refs.current.onSuccess?.())\n .catch(() => refs.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAAS,IAAI;CACnD,MAAM,OAAO,OAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAC1D,MAAM,aAAa,OAAO,KAAK;CAE/B,gBAAgB;EACd,KAAK,UAAU;GAAE;GAAgB;GAAW;EAAQ;CACtD,CAAC;CAED,gBAAgB;EACd,MAAM,UAAU;GACd,GAAG,KAAK,QAAQ;GAChB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,WAAW,SAAS;GACvB,WAAW,UAAU;GACrB,0BAA0B,OAAO,CAAC,CAC/B,WAAW;;IAAK,QAAA,yBAAA,gBAAA,KAAA,QAAA,CAAQ,eAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAA,KAAA,aAAY;GAAC,CAAA,CAAC,CACtC,YAAY;;IAAK,QAAA,yBAAA,iBAAA,KAAA,QAAA,CAAQ,aAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAA,KAAA,cAAU;GAAC,CAAA,CAAC,CACrC,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,IAAY,4BAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,oBAAC,qBAAD;EAAqB,GAAI;EACvB,UAAA,oBAAC,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
1
+ {"version":3,"file":"PersistQueryClientProvider.js","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const optionsRef = useRef({ persistOptions, onSuccess, onError })\n const didRestoreRef = useRef(false)\n\n useEffect(() => {\n optionsRef.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...optionsRef.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestoreRef.current) {\n didRestoreRef.current = true\n persistQueryClientRestore(options)\n .then(() => optionsRef.current.onSuccess?.())\n .catch(() => optionsRef.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAAS,IAAI;CACnD,MAAM,aAAa,OAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAChE,MAAM,gBAAgB,OAAO,KAAK;CAElC,gBAAgB;EACd,WAAW,UAAU;GAAE;GAAgB;GAAW;EAAQ;CAC5D,CAAC;CAED,gBAAgB;EACd,MAAM,UAAU;GACd,GAAG,WAAW,QAAQ;GACtB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,cAAc,SAAS;GAC1B,cAAc,UAAU;GACxB,0BAA0B,OAAO,CAAC,CAC/B,WAAW;;IAAW,QAAA,yBAAA,sBAAA,WAAA,QAAA,CAAQ,eAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAA,KAAA,mBAAY;GAAC,CAAA,CAAC,CAC5C,YAAY;;IAAW,QAAA,0BAAA,uBAAA,WAAA,QAAA,CAAQ,aAAA,QAAA,2BAAA,KAAA,IAAA,KAAA,IAAA,uBAAA,KAAA,oBAAU;GAAC,CAAA,CAAC,CAC3C,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,IAAY,4BAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,oBAAC,qBAAD;EAAqB,GAAI;EACvB,UAAA,oBAAC,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
@@ -6,14 +6,14 @@ let preact_jsx_runtime = require("preact/jsx-runtime");
6
6
  //#region src/PersistQueryClientProvider.tsx
7
7
  const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onError, ...props }) => {
8
8
  const [isRestoring, setIsRestoring] = (0, preact_hooks.useState)(true);
9
- const refs = (0, preact_hooks.useRef)({
9
+ const optionsRef = (0, preact_hooks.useRef)({
10
10
  persistOptions,
11
11
  onSuccess,
12
12
  onError
13
13
  });
14
- const didRestore = (0, preact_hooks.useRef)(false);
14
+ const didRestoreRef = (0, preact_hooks.useRef)(false);
15
15
  (0, preact_hooks.useEffect)(() => {
16
- refs.current = {
16
+ optionsRef.current = {
17
17
  persistOptions,
18
18
  onSuccess,
19
19
  onError
@@ -21,12 +21,12 @@ const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onErr
21
21
  });
22
22
  (0, preact_hooks.useEffect)(() => {
23
23
  const options = {
24
- ...refs.current.persistOptions,
24
+ ...optionsRef.current.persistOptions,
25
25
  queryClient: props.client
26
26
  };
27
- if (!didRestore.current) {
28
- didRestore.current = true;
29
- (0, _tanstack_query_persist_client_core.persistQueryClientRestore)(options).then(() => refs.current.onSuccess?.()).catch(() => refs.current.onError?.()).finally(() => {
27
+ if (!didRestoreRef.current) {
28
+ didRestoreRef.current = true;
29
+ (0, _tanstack_query_persist_client_core.persistQueryClientRestore)(options).then(() => optionsRef.current.onSuccess?.()).catch(() => optionsRef.current.onError?.()).finally(() => {
30
30
  setIsRestoring(false);
31
31
  });
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.cjs","names":["useState","useRef","persistQueryClientSubscribe","QueryClientProvider","IsRestoringProvider"],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const refs = useRef({ persistOptions, onSuccess, onError })\n const didRestore = useRef(false)\n\n useEffect(() => {\n refs.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...refs.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestore.current) {\n didRestore.current = true\n persistQueryClientRestore(options)\n .then(() => refs.current.onSuccess?.())\n .catch(() => refs.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,mBAAA,GAAkBA,aAAAA,SAAAA,CAAS,IAAI;CACnD,MAAM,QAAA,GAAOC,aAAAA,OAAAA,CAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAC1D,MAAM,cAAA,GAAaA,aAAAA,OAAAA,CAAO,KAAK;CAE/B,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,KAAK,UAAU;GAAE;GAAgB;GAAW;EAAQ;CACtD,CAAC;CAED,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,MAAM,UAAU;GACd,GAAG,KAAK,QAAQ;GAChB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,WAAW,SAAS;GACvB,WAAW,UAAU;GACrB,CAAA,GAAA,oCAAA,0BAAA,CAA0B,OAAO,CAAC,CAC/B,WAAW,KAAK,QAAQ,YAAY,CAAC,CAAC,CACtC,YAAY,KAAK,QAAQ,UAAU,CAAC,CAAC,CACrC,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,KAAA,GAAYC,oCAAAA,4BAAAA,CAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;EAAqB,GAAI;EACvB,UAAA,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
1
+ {"version":3,"file":"PersistQueryClientProvider.cjs","names":["useState","useRef","persistQueryClientSubscribe","QueryClientProvider","IsRestoringProvider"],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const optionsRef = useRef({ persistOptions, onSuccess, onError })\n const didRestoreRef = useRef(false)\n\n useEffect(() => {\n optionsRef.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...optionsRef.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestoreRef.current) {\n didRestoreRef.current = true\n persistQueryClientRestore(options)\n .then(() => optionsRef.current.onSuccess?.())\n .catch(() => optionsRef.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,mBAAA,GAAkBA,aAAAA,SAAAA,CAAS,IAAI;CACnD,MAAM,cAAA,GAAaC,aAAAA,OAAAA,CAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAChE,MAAM,iBAAA,GAAgBA,aAAAA,OAAAA,CAAO,KAAK;CAElC,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,WAAW,UAAU;GAAE;GAAgB;GAAW;EAAQ;CAC5D,CAAC;CAED,CAAA,GAAA,aAAA,UAAA,OAAgB;EACd,MAAM,UAAU;GACd,GAAG,WAAW,QAAQ;GACtB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,cAAc,SAAS;GAC1B,cAAc,UAAU;GACxB,CAAA,GAAA,oCAAA,0BAAA,CAA0B,OAAO,CAAC,CAC/B,WAAW,WAAW,QAAQ,YAAY,CAAC,CAAC,CAC5C,YAAY,WAAW,QAAQ,UAAU,CAAC,CAAC,CAC3C,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,KAAA,GAAYC,oCAAAA,4BAAAA,CAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;EAAqB,GAAI;EACvB,UAAA,iBAAA,GAAA,mBAAA,IAAA,CAACC,uBAAAA,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
@@ -2,12 +2,11 @@ import { VNode } from "preact";
2
2
  import { PersistQueryClientOptions } from "@tanstack/query-persist-client-core";
3
3
  import { OmitKeyof, QueryClientProviderProps } from "@tanstack/preact-query";
4
4
  //#region src/PersistQueryClientProvider.d.ts
5
- type PersistQueryClientProviderProps = QueryClientProviderProps & {
5
+ export type PersistQueryClientProviderProps = QueryClientProviderProps & {
6
6
  persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
7
7
  onSuccess?: () => Promise<unknown> | unknown;
8
8
  onError?: () => Promise<unknown> | unknown;
9
9
  };
10
- declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
10
+ export declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
11
11
  //#endregion
12
- export { PersistQueryClientProvider, PersistQueryClientProviderProps };
13
12
  //# sourceMappingURL=PersistQueryClientProvider.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.d.cts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;KAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;cAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
1
+ {"version":3,"file":"PersistQueryClientProvider.d.cts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;YAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;qBAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
@@ -2,12 +2,11 @@ import { PersistQueryClientOptions } from "@tanstack/query-persist-client-core";
2
2
  import { OmitKeyof, QueryClientProviderProps } from "@tanstack/preact-query";
3
3
  import { VNode } from "preact";
4
4
  //#region src/PersistQueryClientProvider.d.ts
5
- type PersistQueryClientProviderProps = QueryClientProviderProps & {
5
+ export type PersistQueryClientProviderProps = QueryClientProviderProps & {
6
6
  persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
7
7
  onSuccess?: () => Promise<unknown> | unknown;
8
8
  onError?: () => Promise<unknown> | unknown;
9
9
  };
10
- declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
10
+ export declare const PersistQueryClientProvider: ({ children, persistOptions, onSuccess, onError, ...props }: PersistQueryClientProviderProps) => VNode;
11
11
  //#endregion
12
- export { PersistQueryClientProvider, PersistQueryClientProviderProps };
13
12
  //# sourceMappingURL=PersistQueryClientProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.d.ts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;KAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;cAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
1
+ {"version":3,"file":"PersistQueryClientProvider.d.ts","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"mappings":";;;;YAiBY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B,kBAAkB;EAClB,gBAAgB;;qBAGL,+BAA8B,UAAA,gBAAA,WAAA,YAAA,SAMxC,oCAAkC"}
@@ -5,14 +5,14 @@ import { jsx } from "preact/jsx-runtime";
5
5
  //#region src/PersistQueryClientProvider.tsx
6
6
  const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onError, ...props }) => {
7
7
  const [isRestoring, setIsRestoring] = useState(true);
8
- const refs = useRef({
8
+ const optionsRef = useRef({
9
9
  persistOptions,
10
10
  onSuccess,
11
11
  onError
12
12
  });
13
- const didRestore = useRef(false);
13
+ const didRestoreRef = useRef(false);
14
14
  useEffect(() => {
15
- refs.current = {
15
+ optionsRef.current = {
16
16
  persistOptions,
17
17
  onSuccess,
18
18
  onError
@@ -20,12 +20,12 @@ const PersistQueryClientProvider = ({ children, persistOptions, onSuccess, onErr
20
20
  });
21
21
  useEffect(() => {
22
22
  const options = {
23
- ...refs.current.persistOptions,
23
+ ...optionsRef.current.persistOptions,
24
24
  queryClient: props.client
25
25
  };
26
- if (!didRestore.current) {
27
- didRestore.current = true;
28
- persistQueryClientRestore(options).then(() => refs.current.onSuccess?.()).catch(() => refs.current.onError?.()).finally(() => {
26
+ if (!didRestoreRef.current) {
27
+ didRestoreRef.current = true;
28
+ persistQueryClientRestore(options).then(() => optionsRef.current.onSuccess?.()).catch(() => optionsRef.current.onError?.()).finally(() => {
29
29
  setIsRestoring(false);
30
30
  });
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PersistQueryClientProvider.js","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const refs = useRef({ persistOptions, onSuccess, onError })\n const didRestore = useRef(false)\n\n useEffect(() => {\n refs.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...refs.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestore.current) {\n didRestore.current = true\n persistQueryClientRestore(options)\n .then(() => refs.current.onSuccess?.())\n .catch(() => refs.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAAS,IAAI;CACnD,MAAM,OAAO,OAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAC1D,MAAM,aAAa,OAAO,KAAK;CAE/B,gBAAgB;EACd,KAAK,UAAU;GAAE;GAAgB;GAAW;EAAQ;CACtD,CAAC;CAED,gBAAgB;EACd,MAAM,UAAU;GACd,GAAG,KAAK,QAAQ;GAChB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,WAAW,SAAS;GACvB,WAAW,UAAU;GACrB,0BAA0B,OAAO,CAAC,CAC/B,WAAW,KAAK,QAAQ,YAAY,CAAC,CAAC,CACtC,YAAY,KAAK,QAAQ,UAAU,CAAC,CAAC,CACrC,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,IAAY,4BAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,oBAAC,qBAAD;EAAqB,GAAI;EACvB,UAAA,oBAAC,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
1
+ {"version":3,"file":"PersistQueryClientProvider.js","names":[],"sources":["../../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'preact/hooks'\nimport type { VNode } from 'preact'\n\nimport {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport {\n IsRestoringProvider,\n QueryClientProvider,\n} from '@tanstack/preact-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type {\n OmitKeyof,\n QueryClientProviderProps,\n} from '@tanstack/preact-query'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => Promise<unknown> | unknown\n onError?: () => Promise<unknown> | unknown\n}\n\nexport const PersistQueryClientProvider = ({\n children,\n persistOptions,\n onSuccess,\n onError,\n ...props\n}: PersistQueryClientProviderProps): VNode => {\n const [isRestoring, setIsRestoring] = useState(true)\n const optionsRef = useRef({ persistOptions, onSuccess, onError })\n const didRestoreRef = useRef(false)\n\n useEffect(() => {\n optionsRef.current = { persistOptions, onSuccess, onError }\n })\n\n useEffect(() => {\n const options = {\n ...optionsRef.current.persistOptions,\n queryClient: props.client,\n }\n if (!didRestoreRef.current) {\n didRestoreRef.current = true\n persistQueryClientRestore(options)\n .then(() => optionsRef.current.onSuccess?.())\n .catch(() => optionsRef.current.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n }\n return isRestoring ? undefined : persistQueryClientSubscribe(options)\n }, [props.client, isRestoring])\n\n return (\n <QueryClientProvider {...props}>\n <IsRestoringProvider value={isRestoring}>{children}</IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":";;;;;AAuBA,MAAa,8BAA8B,EACzC,UACA,gBACA,WACA,SACA,GAAG,YACyC;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAAS,IAAI;CACnD,MAAM,aAAa,OAAO;EAAE;EAAgB;EAAW;CAAQ,CAAC;CAChE,MAAM,gBAAgB,OAAO,KAAK;CAElC,gBAAgB;EACd,WAAW,UAAU;GAAE;GAAgB;GAAW;EAAQ;CAC5D,CAAC;CAED,gBAAgB;EACd,MAAM,UAAU;GACd,GAAG,WAAW,QAAQ;GACtB,aAAa,MAAM;EACrB;EACA,IAAI,CAAC,cAAc,SAAS;GAC1B,cAAc,UAAU;GACxB,0BAA0B,OAAO,CAAC,CAC/B,WAAW,WAAW,QAAQ,YAAY,CAAC,CAAC,CAC5C,YAAY,WAAW,QAAQ,UAAU,CAAC,CAAC,CAC3C,cAAc;IACb,eAAe,KAAK;GACtB,CAAC;EACL;EACA,OAAO,cAAc,KAAA,IAAY,4BAA4B,OAAO;CACtE,GAAG,CAAC,MAAM,QAAQ,WAAW,CAAC;CAE9B,OACE,oBAAC,qBAAD;EAAqB,GAAI;EACvB,UAAA,oBAAC,qBAAD;GAAqB,OAAO;GAAc;EAA8B,CAAA;CACrD,CAAA;AAEzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/preact-query-persist-client",
3
- "version": "5.103.3",
3
+ "version": "5.104.1",
4
4
  "description": "Preact bindings to work with persisters in TanStack/preact-query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -39,21 +39,20 @@
39
39
  "!src/__tests__"
40
40
  ],
41
41
  "dependencies": {
42
- "@tanstack/query-persist-client-core": "5.103.3"
42
+ "@tanstack/query-persist-client-core": "5.104.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@preact/preset-vite": "^2.10.6",
46
- "@tanstack/preact-query": "5.103.3",
46
+ "@tanstack/preact-query": "5.104.1",
47
47
  "@tanstack/query-test-utils": "0.0.0",
48
48
  "@testing-library/preact": "^3.2.4",
49
+ "@typescript-eslint/parser": "^8.70.1",
49
50
  "eslint-config-preact": "^2.0.0",
50
- "npm-run-all2": "^9.0.3",
51
51
  "preact": "^10.29.8",
52
- "typescript": "6.0.3",
53
- "typescript-eslint": "^8.54.0"
52
+ "typescript": "6.0.3"
54
53
  },
55
54
  "peerDependencies": {
56
- "@tanstack/preact-query": "^5.103.3",
55
+ "@tanstack/preact-query": "^5.104.1",
57
56
  "preact": "^10.0.0"
58
57
  },
59
58
  "scripts": {
@@ -66,7 +65,7 @@
66
65
  "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts58 --tsBuildInfoFile .cache/test-types/ts58.tsbuildinfo",
67
66
  "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts59 --tsBuildInfoFile .cache/test-types/ts59.tsbuildinfo",
68
67
  "test:types:tscurrent": "tsc --project tsconfig.json --outDir .cache/test-types/tscurrent --tsBuildInfoFile .cache/test-types/tscurrent.tsbuildinfo",
69
- "test:types:ts70": "node ../../node_modules/typescript70/lib/tsc.js --project tsconfig.json --outDir .cache/test-types/ts70 --tsBuildInfoFile .cache/test-types/ts70.tsbuildinfo",
68
+ "test:types:ts70": "node ../../node_modules/typescript70/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts70 --tsBuildInfoFile .cache/test-types/ts70.tsbuildinfo",
70
69
  "test:lib": "vitest --retry=3",
71
70
  "test:lib:dev": "pnpm run test:lib --watch",
72
71
  "test:build": "publint --strict && attw --pack",
@@ -29,23 +29,23 @@ export const PersistQueryClientProvider = ({
29
29
  ...props
30
30
  }: PersistQueryClientProviderProps): VNode => {
31
31
  const [isRestoring, setIsRestoring] = useState(true)
32
- const refs = useRef({ persistOptions, onSuccess, onError })
33
- const didRestore = useRef(false)
32
+ const optionsRef = useRef({ persistOptions, onSuccess, onError })
33
+ const didRestoreRef = useRef(false)
34
34
 
35
35
  useEffect(() => {
36
- refs.current = { persistOptions, onSuccess, onError }
36
+ optionsRef.current = { persistOptions, onSuccess, onError }
37
37
  })
38
38
 
39
39
  useEffect(() => {
40
40
  const options = {
41
- ...refs.current.persistOptions,
41
+ ...optionsRef.current.persistOptions,
42
42
  queryClient: props.client,
43
43
  }
44
- if (!didRestore.current) {
45
- didRestore.current = true
44
+ if (!didRestoreRef.current) {
45
+ didRestoreRef.current = true
46
46
  persistQueryClientRestore(options)
47
- .then(() => refs.current.onSuccess?.())
48
- .catch(() => refs.current.onError?.())
47
+ .then(() => optionsRef.current.onSuccess?.())
48
+ .catch(() => optionsRef.current.onError?.())
49
49
  .finally(() => {
50
50
  setIsRestoring(false)
51
51
  })