@tanstack/solid-query-persist-client 5.107.1 → 5.107.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/build/dev.cjs +1 -1
- package/build/dev.js +1 -1
- package/build/index.cjs +1 -1
- package/build/index.d.cts +2 -1
- package/build/index.d.cts.map +1 -1
- package/build/index.d.ts +3 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/PersistQueryClientProvider.tsx +1 -1
- package/src/index.ts +3 -1
package/build/dev.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let _tanstack_query_persist_client_core = require("@tanstack/query-persist-client-core");
|
|
3
3
|
let solid_js_web = require("solid-js/web");
|
|
4
|
-
let solid_js = require("solid-js");
|
|
5
4
|
let _tanstack_solid_query = require("@tanstack/solid-query");
|
|
5
|
+
let solid_js = require("solid-js");
|
|
6
6
|
// src/PersistQueryClientProvider.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:
|
package/build/dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { persistQueryClientRestore, persistQueryClientSubscribe } from "@tanstack/query-persist-client-core";
|
|
2
2
|
import { createComponent } from "solid-js/web";
|
|
3
|
-
import { createEffect, createMemo, createSignal, onCleanup } from "solid-js";
|
|
4
3
|
import { IsRestoringProvider, QueryClientProvider } from "@tanstack/solid-query";
|
|
4
|
+
import { createEffect, createMemo, createSignal, onCleanup } from "solid-js";
|
|
5
5
|
export * from "@tanstack/query-persist-client-core";
|
|
6
6
|
// src/PersistQueryClientProvider.tsx
|
|
7
7
|
/**
|
package/build/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@tanstack/query-persist-client-core"),t=require("solid-js/web"),n=require("solid-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@tanstack/query-persist-client-core"),t=require("solid-js/web"),n=require("@tanstack/solid-query"),r=require("solid-js");const i=i=>{let[a,o]=(0,r.createSignal)(!0),s=(0,r.createMemo)(()=>({...i.persistOptions,queryClient:i.client}));return(0,r.createEffect)(()=>{o(!0),(0,e.persistQueryClientRestore)(s()).then(()=>i.onSuccess?.()).catch(()=>i.onError?.()).finally(()=>{o(!1)})}),(0,r.createEffect)(()=>{let t=()=>{};a()||(t=(0,e.persistQueryClientSubscribe)(s())),(0,r.onCleanup)(()=>t())}),(0,t.createComponent)(n.QueryClientProvider,{get client(){return i.client},get children(){return(0,t.createComponent)(n.IsRestoringProvider,{value:a,get children(){return i.children}})}})};exports.PersistQueryClientProvider=i,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/build/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ export * from "@tanstack/query-persist-client-core";
|
|
|
6
6
|
* The props of `PersistQueryClientProvider`: the props of `QueryClientProvider`, plus the
|
|
7
7
|
* `persistOptions` and callbacks for when restoring succeeds or fails.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
10
10
|
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
|
|
11
11
|
onSuccess?: () => void;
|
|
12
12
|
onError?: () => void;
|
|
@@ -22,4 +22,5 @@ export type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
|
22
22
|
* @returns The `QueryClientProvider` wrapping the children.
|
|
23
23
|
*/
|
|
24
24
|
export declare const PersistQueryClientProvider: (props: PersistQueryClientProviderProps) => JSX.Element;
|
|
25
|
+
export type { PersistQueryClientProviderProps };
|
|
25
26
|
//# sourceMappingURL=index.d.cts.map
|
package/build/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/PersistQueryClientProvider.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/PersistQueryClientProvider.tsx"],"mappings":";;;;;;;;KAcY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B;EACA;;;;;;;;;;;;qBAaW,6BACX,OAAO,oCACN,IAAI"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PersistQueryClientOptions } from "@tanstack/query-persist-client-core";
|
|
2
|
-
import { JSX } from "solid-js";
|
|
3
2
|
import { OmitKeyof, QueryClientProviderProps } from "@tanstack/solid-query";
|
|
3
|
+
import { JSX } from "solid-js";
|
|
4
4
|
export * from "@tanstack/query-persist-client-core";
|
|
5
5
|
/**
|
|
6
6
|
* The props of `PersistQueryClientProvider`: the props of `QueryClientProvider`, plus the
|
|
7
7
|
* `persistOptions` and callbacks for when restoring succeeds or fails.
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
10
10
|
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
|
|
11
11
|
onSuccess?: () => void;
|
|
12
12
|
onError?: () => void;
|
|
@@ -22,4 +22,5 @@ export type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
|
22
22
|
* @returns The `QueryClientProvider` wrapping the children.
|
|
23
23
|
*/
|
|
24
24
|
export declare const PersistQueryClientProvider: (props: PersistQueryClientProviderProps) => JSX.Element;
|
|
25
|
+
export type { PersistQueryClientProviderProps };
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/PersistQueryClientProvider.tsx"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/PersistQueryClientProvider.tsx"],"mappings":";;;;;;;;KAcY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B;EACA;;;;;;;;;;;;qBAaW,6BACX,OAAO,oCACN,IAAI"}
|
package/build/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{persistQueryClientRestore as e,persistQueryClientSubscribe as t}from"@tanstack/query-persist-client-core";import{createComponent as n}from"solid-js/web";import{
|
|
1
|
+
import{persistQueryClientRestore as e,persistQueryClientSubscribe as t}from"@tanstack/query-persist-client-core";import{createComponent as n}from"solid-js/web";import{IsRestoringProvider as r,QueryClientProvider as i}from"@tanstack/solid-query";import{createEffect as a,createMemo as o,createSignal as s,onCleanup as c}from"solid-js";export*from"@tanstack/query-persist-client-core";const l=l=>{let[u,d]=s(!0),f=o(()=>({...l.persistOptions,queryClient:l.client}));return a(()=>{d(!0),e(f()).then(()=>l.onSuccess?.()).catch(()=>l.onError?.()).finally(()=>{d(!1)})}),a(()=>{let e=()=>{};u()||(e=t(f())),c(()=>e())}),n(i,{get client(){return l.client},get children(){return n(r,{value:u,get children(){return l.children}})}})};export{l as PersistQueryClientProvider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["persistQueryClientRestore","persistQueryClientSubscribe","
|
|
1
|
+
{"version":3,"file":"index.js","names":["persistQueryClientRestore","persistQueryClientSubscribe","IsRestoringProvider","QueryClientProvider","createEffect","createMemo","createSignal","onCleanup","PersistQueryClientOptions","OmitKeyof","QueryClientProviderProps","JSX","PersistQueryClientProviderProps","persistOptions","onSuccess","onError","PersistQueryClientProvider","props","Element","isRestoring","setIsRestoring","options","queryClient","client","then","catch","finally","unsubscribe","_$createComponent","children","value","_$createComponent","PersistQueryClientProvider","isRestoring","setIsRestoring","createSignal","options","createMemo","props","createEffect","persistQueryClientRestore","unsubscribe","persistQueryClientSubscribe","onCleanup","createComponent","QueryClientProvider","IsRestoringProvider"],"sources":["../src/PersistQueryClientProvider.tsx"],"sourcesContent":["import {\n persistQueryClientRestore,\n persistQueryClientSubscribe,\n} from '@tanstack/query-persist-client-core'\nimport { IsRestoringProvider, QueryClientProvider } from '@tanstack/solid-query'\nimport { createEffect, createMemo, createSignal, onCleanup } from 'solid-js'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type { OmitKeyof, QueryClientProviderProps } from '@tanstack/solid-query'\nimport type { JSX } from 'solid-js'\n\n/**\n * The props of `PersistQueryClientProvider`: the props of `QueryClientProvider`, plus the\n * `persistOptions` and callbacks for when restoring succeeds or fails.\n */\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => void\n onError?: () => void\n}\n\n/**\n * Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:\n * while restoring, `useIsRestoring` returns `true` and queries wait for the restore to finish\n * before subscribing. Once restored, the client is saved with the persister whenever the cache\n * changes.\n * @param props - The `QueryClientProvider` props, the `persistOptions`, and the `onSuccess` and\n * `onError` callbacks. `onSuccess` is called once restoring finishes, even if nothing was restored\n * (e.g. because the persisted client expired), and `onError` if restoring or `onSuccess` throws.\n * @returns The `QueryClientProvider` wrapping the children.\n */\nexport const PersistQueryClientProvider = (\n props: PersistQueryClientProviderProps,\n): JSX.Element => {\n const [isRestoring, setIsRestoring] = createSignal(true)\n\n const options = createMemo(() => ({\n ...props.persistOptions,\n queryClient: props.client,\n }))\n\n createEffect(() => {\n setIsRestoring(true)\n persistQueryClientRestore(options())\n .then(() => props.onSuccess?.())\n .catch(() => props.onError?.())\n .finally(() => {\n setIsRestoring(false)\n })\n })\n\n createEffect(() => {\n let unsubscribe = () => {}\n if (!isRestoring()) {\n unsubscribe = persistQueryClientSubscribe(options())\n }\n onCleanup(() => unsubscribe())\n })\n\n return (\n <QueryClientProvider client={props.client}>\n <IsRestoringProvider value={isRestoring}>\n {props.children}\n </IsRestoringProvider>\n </QueryClientProvider>\n )\n}\n"],"mappings":"A,+XA8BA,MAAagB,EACXC,GACgB,CAChB,GAAM,CAACE,EAAaC,GAAkBd,EAAa,EAAI,EAEjDe,EAAUhB,OAAkB,CAChC,GAAGY,EAAMJ,eACTS,YAAaL,EAAMM,MACrB,EAAE,EAoBF,OAlBAnB,MAAmB,CACjBgB,EAAe,EAAI,EACnBpB,EAA0BqB,EAAQ,CAAC,CAAC,CACjCG,SAAWP,EAAMH,YAAY,CAAC,CAAC,CAC/BW,UAAYR,EAAMF,UAAU,CAAC,CAAC,CAC9BW,YAAc,CACbN,EAAe,EAAK,CACtB,CAAC,CACL,CAAC,EAEDhB,MAAmB,CACjB,IAAIuB,MAAoB,CAAC,EACpBR,EAAY,IACfQ,EAAc1B,EAA4BoB,EAAQ,CAAC,GAErDd,MAAgBoB,EAAY,CAAC,CAC/B,CAAC,EAEDC,EACGzB,EAAmB,CAAA,IAACoB,QAAM,CAAA,OAAEN,EAAMM,MAAM,EAAA,IAAAM,UAAA,CAAA,OAAAD,EACtC1B,EAAmB,CAAC4B,MAAOX,EAAW,IAAAU,UAAA,CAAA,OACpCZ,EAAMY,QAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAIvB,E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query-persist-client",
|
|
3
|
-
"version": "5.107.
|
|
3
|
+
"version": "5.107.2",
|
|
4
4
|
"description": "Solid.js bindings to work with persisters in TanStack/solid-query",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"!src/__tests__"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@tanstack/query-persist-client-core": "5.107.
|
|
49
|
+
"@tanstack/query-persist-client-core": "5.107.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@solidjs/testing-library": "^0.8.10",
|
|
53
53
|
"@tanstack/query-test-utils": "0.0.0",
|
|
54
|
-
"@tanstack/solid-query": "5.107.
|
|
54
|
+
"@tanstack/solid-query": "5.107.2",
|
|
55
55
|
"eslint-plugin-solid": "^0.18.1",
|
|
56
56
|
"solid-js": "^1.9.18",
|
|
57
57
|
"typescript": "6.0.3",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"vite-plugin-solid": "^2.11.15"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@tanstack/solid-query": "^5.107.
|
|
62
|
+
"@tanstack/solid-query": "^5.107.2",
|
|
63
63
|
"solid-js": "^1.6.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
persistQueryClientRestore,
|
|
3
3
|
persistQueryClientSubscribe,
|
|
4
4
|
} from '@tanstack/query-persist-client-core'
|
|
5
|
-
import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js'
|
|
6
5
|
import { IsRestoringProvider, QueryClientProvider } from '@tanstack/solid-query'
|
|
6
|
+
import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js'
|
|
7
7
|
import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'
|
|
8
8
|
import type { OmitKeyof, QueryClientProviderProps } from '@tanstack/solid-query'
|
|
9
9
|
import type { JSX } from 'solid-js'
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Re-export core
|
|
2
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax
|
|
2
3
|
export * from '@tanstack/query-persist-client-core'
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
+
export { PersistQueryClientProvider } from './PersistQueryClientProvider'
|
|
6
|
+
export type { PersistQueryClientProviderProps } from './PersistQueryClientProvider'
|