@tanstack/solid-query-persist-client 5.104.1 → 5.104.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 +10 -0
- package/build/dev.js +10 -0
- package/build/index.d.cts +14 -0
- package/build/index.d.cts.map +1 -1
- package/build/index.d.ts +14 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/package.json +7 -6
- package/src/PersistQueryClientProvider.tsx +14 -0
package/build/dev.cjs
CHANGED
|
@@ -4,6 +4,16 @@ let solid_js_web = require("solid-js/web");
|
|
|
4
4
|
let solid_js = require("solid-js");
|
|
5
5
|
let _tanstack_solid_query = require("@tanstack/solid-query");
|
|
6
6
|
//#region src/PersistQueryClientProvider.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:
|
|
9
|
+
* while restoring, `useIsRestoring` returns `true` and queries wait for the restore to finish
|
|
10
|
+
* before subscribing. Once restored, the client is saved with the persister whenever the cache
|
|
11
|
+
* changes.
|
|
12
|
+
* @param props - The `QueryClientProvider` props, the `persistOptions`, and the `onSuccess` and
|
|
13
|
+
* `onError` callbacks. `onSuccess` is called once restoring finishes, even if nothing was restored
|
|
14
|
+
* (e.g. because the persisted client expired), and `onError` if restoring or `onSuccess` throws.
|
|
15
|
+
* @returns The `QueryClientProvider` wrapping the children.
|
|
16
|
+
*/
|
|
7
17
|
const PersistQueryClientProvider = (props) => {
|
|
8
18
|
const [isRestoring, setIsRestoring] = (0, solid_js.createSignal)(true);
|
|
9
19
|
const options = (0, solid_js.createMemo)(() => ({
|
package/build/dev.js
CHANGED
|
@@ -4,6 +4,16 @@ import { createEffect, createMemo, createSignal, onCleanup } from "solid-js";
|
|
|
4
4
|
import { IsRestoringProvider, QueryClientProvider } from "@tanstack/solid-query";
|
|
5
5
|
export * from "@tanstack/query-persist-client-core";
|
|
6
6
|
//#region src/PersistQueryClientProvider.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:
|
|
9
|
+
* while restoring, `useIsRestoring` returns `true` and queries wait for the restore to finish
|
|
10
|
+
* before subscribing. Once restored, the client is saved with the persister whenever the cache
|
|
11
|
+
* changes.
|
|
12
|
+
* @param props - The `QueryClientProvider` props, the `persistOptions`, and the `onSuccess` and
|
|
13
|
+
* `onError` callbacks. `onSuccess` is called once restoring finishes, even if nothing was restored
|
|
14
|
+
* (e.g. because the persisted client expired), and `onError` if restoring or `onSuccess` throws.
|
|
15
|
+
* @returns The `QueryClientProvider` wrapping the children.
|
|
16
|
+
*/
|
|
7
17
|
const PersistQueryClientProvider = (props) => {
|
|
8
18
|
const [isRestoring, setIsRestoring] = createSignal(true);
|
|
9
19
|
const options = createMemo(() => ({
|
package/build/index.d.cts
CHANGED
|
@@ -3,11 +3,25 @@ import { OmitKeyof, QueryClientProviderProps } from "@tanstack/solid-query";
|
|
|
3
3
|
import { JSX } from "solid-js";
|
|
4
4
|
export * from "@tanstack/query-persist-client-core";
|
|
5
5
|
//#region src/PersistQueryClientProvider.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The props of `PersistQueryClientProvider`: the props of `QueryClientProvider`, plus the
|
|
8
|
+
* `persistOptions` and callbacks for when restoring succeeds or fails.
|
|
9
|
+
*/
|
|
6
10
|
export type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
7
11
|
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
|
|
8
12
|
onSuccess?: () => void;
|
|
9
13
|
onError?: () => void;
|
|
10
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:
|
|
17
|
+
* while restoring, `useIsRestoring` returns `true` and queries wait for the restore to finish
|
|
18
|
+
* before subscribing. Once restored, the client is saved with the persister whenever the cache
|
|
19
|
+
* changes.
|
|
20
|
+
* @param props - The `QueryClientProvider` props, the `persistOptions`, and the `onSuccess` and
|
|
21
|
+
* `onError` callbacks. `onSuccess` is called once restoring finishes, even if nothing was restored
|
|
22
|
+
* (e.g. because the persisted client expired), and `onError` if restoring or `onSuccess` throws.
|
|
23
|
+
* @returns The `QueryClientProvider` wrapping the children.
|
|
24
|
+
*/
|
|
11
25
|
export declare const PersistQueryClientProvider: (props: PersistQueryClientProviderProps) => JSX.Element;
|
|
12
26
|
//#endregion
|
|
13
27
|
//# 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":";;;;;;;;;YAcY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B;EACA;;;;;;;;;;;;qBAaW,6BACX,OAAO,oCACN,IAAI"}
|
package/build/index.d.ts
CHANGED
|
@@ -3,11 +3,25 @@ import { JSX } from "solid-js";
|
|
|
3
3
|
import { OmitKeyof, QueryClientProviderProps } from "@tanstack/solid-query";
|
|
4
4
|
export * from "@tanstack/query-persist-client-core";
|
|
5
5
|
//#region src/PersistQueryClientProvider.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The props of `PersistQueryClientProvider`: the props of `QueryClientProvider`, plus the
|
|
8
|
+
* `persistOptions` and callbacks for when restoring succeeds or fails.
|
|
9
|
+
*/
|
|
6
10
|
export type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
7
11
|
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>;
|
|
8
12
|
onSuccess?: () => void;
|
|
9
13
|
onError?: () => void;
|
|
10
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:
|
|
17
|
+
* while restoring, `useIsRestoring` returns `true` and queries wait for the restore to finish
|
|
18
|
+
* before subscribing. Once restored, the client is saved with the persister whenever the cache
|
|
19
|
+
* changes.
|
|
20
|
+
* @param props - The `QueryClientProvider` props, the `persistOptions`, and the `onSuccess` and
|
|
21
|
+
* `onError` callbacks. `onSuccess` is called once restoring finishes, even if nothing was restored
|
|
22
|
+
* (e.g. because the persisted client expired), and `onError` if restoring or `onSuccess` throws.
|
|
23
|
+
* @returns The `QueryClientProvider` wrapping the children.
|
|
24
|
+
*/
|
|
11
25
|
export declare const PersistQueryClientProvider: (props: PersistQueryClientProviderProps) => JSX.Element;
|
|
12
26
|
//#endregion
|
|
13
27
|
//# 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":";;;;;;;;;YAcY,kCAAkC;EAC5C,gBAAgB,UAAU;EAC1B;EACA;;;;;;;;;;;;qBAaW,6BACX,OAAO,oCACN,IAAI"}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["persistQueryClientRestore","persistQueryClientSubscribe","createEffect","createMemo","createSignal","onCleanup","IsRestoringProvider","QueryClientProvider","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 { createEffect, createMemo, createSignal, onCleanup } from 'solid-js'\nimport { IsRestoringProvider, QueryClientProvider } from '@tanstack/solid-query'\nimport type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'\nimport type { OmitKeyof, QueryClientProviderProps } from '@tanstack/solid-query'\nimport type { JSX } from 'solid-js'\n\nexport type PersistQueryClientProviderProps = QueryClientProviderProps & {\n persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>\n onSuccess?: () => void\n onError?: () => void\n}\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":"+
|
|
1
|
+
{"version":3,"file":"index.js","names":["persistQueryClientRestore","persistQueryClientSubscribe","createEffect","createMemo","createSignal","onCleanup","IsRestoringProvider","QueryClientProvider","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 { createEffect, createMemo, createSignal, onCleanup } from 'solid-js'\nimport { IsRestoringProvider, QueryClientProvider } from '@tanstack/solid-query'\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":"+XA8BA,MAAagB,EACXC,GACgB,CAChB,GAAM,CAACE,EAAaC,GAAkBhB,EAAa,EAAI,EAEjDiB,EAAUlB,OAAkB,CAChC,GAAGc,EAAMJ,eACTS,YAAaL,EAAMM,MACrB,EAAE,EAoBF,OAlBArB,MAAmB,CACjBkB,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,EAEDlB,MAAmB,CACjB,IAAIyB,MAAoB,CAAC,EACpBR,EAAY,IACfQ,EAAc1B,EAA4BoB,EAAQ,CAAC,GAErDhB,MAAgBsB,EAAY,CAAC,CAC/B,CAAC,EAEDC,EACGrB,EAAmB,CAAA,IAACgB,QAAM,CAAA,OAAEN,EAAMM,MAAM,EAAA,IAAAM,UAAA,CAAA,OAAAD,EACtCtB,EAAmB,CAACwB,MAAOX,EAAW,IAAAU,UAAA,CAAA,OACpCZ,EAAMY,QAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAIvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query-persist-client",
|
|
3
|
-
"version": "5.104.
|
|
3
|
+
"version": "5.104.2",
|
|
4
4
|
"description": "Solid.js bindings to work with persisters in TanStack/solid-query",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,32 +46,33 @@
|
|
|
46
46
|
"!src/__tests__"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@tanstack/query-persist-client-core": "5.104.
|
|
49
|
+
"@tanstack/query-persist-client-core": "5.104.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.104.
|
|
54
|
+
"@tanstack/solid-query": "5.104.2",
|
|
55
|
+
"eslint-plugin-solid": "^0.18.1",
|
|
55
56
|
"solid-js": "^1.9.15",
|
|
56
57
|
"typescript": "6.0.3",
|
|
57
58
|
"unplugin-solid": "^2.0.0",
|
|
58
59
|
"vite-plugin-solid": "^2.11.14"
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
|
-
"@tanstack/solid-query": "^5.104.
|
|
62
|
+
"@tanstack/solid-query": "^5.104.2",
|
|
62
63
|
"solid-js": "^1.6.0"
|
|
63
64
|
},
|
|
64
65
|
"scripts": {
|
|
65
66
|
"clean": "premove ./build ./coverage ./dist-ts ./.cache/test-types",
|
|
66
67
|
"compile": "tsc --project tsconfig.json",
|
|
67
|
-
"test:
|
|
68
|
+
"test:oxlint": "oxlint ./src",
|
|
68
69
|
"test:types": "npm-run-all --serial test:types:*",
|
|
69
|
-
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts56 --tsBuildInfoFile .cache/test-types/ts56.tsbuildinfo",
|
|
70
70
|
"test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts57 --tsBuildInfoFile .cache/test-types/ts57.tsbuildinfo",
|
|
71
71
|
"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",
|
|
72
72
|
"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",
|
|
73
73
|
"test:types:tscurrent": "tsc --project tsconfig.json --outDir .cache/test-types/tscurrent --tsBuildInfoFile .cache/test-types/tscurrent.tsbuildinfo",
|
|
74
74
|
"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",
|
|
75
|
+
"test:types:ts71": "node ../../node_modules/typescript71/lib/tsc.js --project tsconfig.legacy.json --outDir .cache/test-types/ts71 --tsBuildInfoFile .cache/test-types/ts71.tsbuildinfo",
|
|
75
76
|
"test:lib": "vitest",
|
|
76
77
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
77
78
|
"test:build": "publint --strict && attw --pack",
|
|
@@ -8,12 +8,26 @@ import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-c
|
|
|
8
8
|
import type { OmitKeyof, QueryClientProviderProps } from '@tanstack/solid-query'
|
|
9
9
|
import type { JSX } from 'solid-js'
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* The props of `PersistQueryClientProvider`: the props of `QueryClientProvider`, plus the
|
|
13
|
+
* `persistOptions` and callbacks for when restoring succeeds or fails.
|
|
14
|
+
*/
|
|
11
15
|
export type PersistQueryClientProviderProps = QueryClientProviderProps & {
|
|
12
16
|
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>
|
|
13
17
|
onSuccess?: () => void
|
|
14
18
|
onError?: () => void
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Provides the `QueryClient` like `QueryClientProvider`, and restores the persisted client first:
|
|
23
|
+
* while restoring, `useIsRestoring` returns `true` and queries wait for the restore to finish
|
|
24
|
+
* before subscribing. Once restored, the client is saved with the persister whenever the cache
|
|
25
|
+
* changes.
|
|
26
|
+
* @param props - The `QueryClientProvider` props, the `persistOptions`, and the `onSuccess` and
|
|
27
|
+
* `onError` callbacks. `onSuccess` is called once restoring finishes, even if nothing was restored
|
|
28
|
+
* (e.g. because the persisted client expired), and `onError` if restoring or `onSuccess` throws.
|
|
29
|
+
* @returns The `QueryClientProvider` wrapping the children.
|
|
30
|
+
*/
|
|
17
31
|
export const PersistQueryClientProvider = (
|
|
18
32
|
props: PersistQueryClientProviderProps,
|
|
19
33
|
): JSX.Element => {
|