@tanstack/solid-query-persist-client 5.108.0 → 5.108.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/index.js.map +1 -1
- package/package.json +4 -4
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["persistQueryClientRestore","persistQueryClientSubscribe","IsRestoringProvider","QueryClientProvider","createEffect","createMemo","createSignal","onCleanup","
|
|
1
|
+
{"version":3,"file":"index.js","names":["persistQueryClientRestore","persistQueryClientSubscribe","IsRestoringProvider","QueryClientProvider","createEffect","createMemo","createSignal","onCleanup","persistOptions","onSuccess","onError","PersistQueryClientProvider","props","isRestoring","setIsRestoring","options","queryClient","client","then","catch","finally","unsubscribe","_$createComponent","children","value","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,MAAaW,EACXC,GACgB,CAChB,GAAM,CAACC,EAAaC,GAAkBR,EAAa,EAAI,EAEjDS,EAAUV,OAAkB,CAChC,GAAGO,EAAMJ,eACTQ,YAAaJ,EAAMK,MACrB,EAAE,EAoBF,OAlBAb,MAAmB,CACjBU,EAAe,EAAI,EACnBd,EAA0Be,EAAQ,CAAC,CAAC,CACjCG,SAAWN,EAAMH,YAAY,CAAC,CAAC,CAC/BU,UAAYP,EAAMF,UAAU,CAAC,CAAC,CAC9BU,YAAc,CACbN,EAAe,EAAK,CACtB,CAAC,CACL,CAAC,EAEDV,MAAmB,CACjB,IAAIiB,MAAoB,CAAC,EACpBR,EAAY,IACfQ,EAAcpB,EAA4Bc,EAAQ,CAAC,GAErDR,MAAgBc,EAAY,CAAC,CAC/B,CAAC,EAEDC,EACGnB,EAAmB,CAAA,IAACc,QAAM,CAAA,OAAEL,EAAMK,MAAM,EAAA,IAAAM,UAAA,CAAA,OAAAD,EACtCpB,EAAmB,CAACsB,MAAOX,EAAW,IAAAU,UAAA,CAAA,OACpCX,EAAMW,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.108.
|
|
3
|
+
"version": "5.108.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.108.
|
|
49
|
+
"@tanstack/query-persist-client-core": "5.108.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.108.
|
|
54
|
+
"@tanstack/solid-query": "5.108.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.108.
|
|
62
|
+
"@tanstack/solid-query": "^5.108.2",
|
|
63
63
|
"solid-js": "^1.6.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|