@tanstack/solid-query-persist-client 5.24.1 → 5.24.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 +13 -16
- package/build/dev.js +15 -18
- package/build/index.cjs +13 -16
- package/build/index.js +15 -18
- package/package.json +3 -3
- package/src/PersistQueryClientProvider.tsx +18 -18
package/build/dev.cjs
CHANGED
|
@@ -8,31 +8,28 @@ var solidQuery = require('@tanstack/solid-query');
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
exports.PersistQueryClientProvider = (props) => {
|
|
10
10
|
const [isRestoring, setIsRestoring] = solidJs.createSignal(true);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const options = solidJs.createMemo(() => ({
|
|
12
|
+
...props.persistOptions,
|
|
13
|
+
queryClient: props.client
|
|
14
|
+
}));
|
|
15
|
+
solidJs.createEffect(() => {
|
|
15
16
|
setIsRestoring(true);
|
|
16
|
-
|
|
17
|
-
...props.persistOptions,
|
|
18
|
-
queryClient: props.client
|
|
19
|
-
});
|
|
20
|
-
promise.then(async () => {
|
|
21
|
-
if (isStale)
|
|
22
|
-
return;
|
|
17
|
+
queryPersistClientCore.persistQueryClientRestore(options()).then(async () => {
|
|
23
18
|
try {
|
|
24
19
|
await props.onSuccess?.();
|
|
25
20
|
} finally {
|
|
26
21
|
setIsRestoring(false);
|
|
27
22
|
}
|
|
28
23
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
});
|
|
25
|
+
solidJs.createEffect(() => {
|
|
26
|
+
let unsubscribe = () => {
|
|
32
27
|
};
|
|
33
|
-
|
|
28
|
+
if (!isRestoring()) {
|
|
29
|
+
unsubscribe = queryPersistClientCore.persistQueryClientSubscribe(options());
|
|
30
|
+
}
|
|
31
|
+
solidJs.onCleanup(() => unsubscribe());
|
|
34
32
|
});
|
|
35
|
-
solidJs.onCleanup(() => _unsubscribe?.());
|
|
36
33
|
return web.createComponent(solidQuery.QueryClientProvider, {
|
|
37
34
|
get client() {
|
|
38
35
|
return props.client;
|
package/build/dev.js
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { persistQueryClientRestore, persistQueryClientSubscribe } from '@tanstack/query-persist-client-core';
|
|
2
2
|
export * from '@tanstack/query-persist-client-core';
|
|
3
3
|
import { createComponent } from 'solid-js/web';
|
|
4
|
-
import { createSignal,
|
|
4
|
+
import { createSignal, createMemo, createEffect, onCleanup } from 'solid-js';
|
|
5
5
|
import { QueryClientProvider, IsRestoringProvider } from '@tanstack/solid-query';
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
var PersistQueryClientProvider = (props) => {
|
|
9
9
|
const [isRestoring, setIsRestoring] = createSignal(true);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const options = createMemo(() => ({
|
|
11
|
+
...props.persistOptions,
|
|
12
|
+
queryClient: props.client
|
|
13
|
+
}));
|
|
14
|
+
createEffect(() => {
|
|
14
15
|
setIsRestoring(true);
|
|
15
|
-
|
|
16
|
-
...props.persistOptions,
|
|
17
|
-
queryClient: props.client
|
|
18
|
-
});
|
|
19
|
-
promise.then(async () => {
|
|
20
|
-
if (isStale)
|
|
21
|
-
return;
|
|
16
|
+
persistQueryClientRestore(options()).then(async () => {
|
|
22
17
|
try {
|
|
23
18
|
await props.onSuccess?.();
|
|
24
19
|
} finally {
|
|
25
20
|
setIsRestoring(false);
|
|
26
21
|
}
|
|
27
22
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
});
|
|
24
|
+
createEffect(() => {
|
|
25
|
+
let unsubscribe = () => {
|
|
31
26
|
};
|
|
32
|
-
|
|
27
|
+
if (!isRestoring()) {
|
|
28
|
+
unsubscribe = persistQueryClientSubscribe(options());
|
|
29
|
+
}
|
|
30
|
+
onCleanup(() => unsubscribe());
|
|
33
31
|
});
|
|
34
|
-
onCleanup(() => _unsubscribe?.());
|
|
35
32
|
return createComponent(QueryClientProvider, {
|
|
36
33
|
get client() {
|
|
37
34
|
return props.client;
|
package/build/index.cjs
CHANGED
|
@@ -8,31 +8,28 @@ var solidQuery = require('@tanstack/solid-query');
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
exports.PersistQueryClientProvider = (props) => {
|
|
10
10
|
const [isRestoring, setIsRestoring] = solidJs.createSignal(true);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const options = solidJs.createMemo(() => ({
|
|
12
|
+
...props.persistOptions,
|
|
13
|
+
queryClient: props.client
|
|
14
|
+
}));
|
|
15
|
+
solidJs.createEffect(() => {
|
|
15
16
|
setIsRestoring(true);
|
|
16
|
-
|
|
17
|
-
...props.persistOptions,
|
|
18
|
-
queryClient: props.client
|
|
19
|
-
});
|
|
20
|
-
promise.then(async () => {
|
|
21
|
-
if (isStale)
|
|
22
|
-
return;
|
|
17
|
+
queryPersistClientCore.persistQueryClientRestore(options()).then(async () => {
|
|
23
18
|
try {
|
|
24
19
|
await props.onSuccess?.();
|
|
25
20
|
} finally {
|
|
26
21
|
setIsRestoring(false);
|
|
27
22
|
}
|
|
28
23
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
});
|
|
25
|
+
solidJs.createEffect(() => {
|
|
26
|
+
let unsubscribe = () => {
|
|
32
27
|
};
|
|
33
|
-
|
|
28
|
+
if (!isRestoring()) {
|
|
29
|
+
unsubscribe = queryPersistClientCore.persistQueryClientSubscribe(options());
|
|
30
|
+
}
|
|
31
|
+
solidJs.onCleanup(() => unsubscribe());
|
|
34
32
|
});
|
|
35
|
-
solidJs.onCleanup(() => _unsubscribe?.());
|
|
36
33
|
return web.createComponent(solidQuery.QueryClientProvider, {
|
|
37
34
|
get client() {
|
|
38
35
|
return props.client;
|
package/build/index.js
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { persistQueryClientRestore, persistQueryClientSubscribe } from '@tanstack/query-persist-client-core';
|
|
2
2
|
export * from '@tanstack/query-persist-client-core';
|
|
3
3
|
import { createComponent } from 'solid-js/web';
|
|
4
|
-
import { createSignal,
|
|
4
|
+
import { createSignal, createMemo, createEffect, onCleanup } from 'solid-js';
|
|
5
5
|
import { QueryClientProvider, IsRestoringProvider } from '@tanstack/solid-query';
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
var PersistQueryClientProvider = (props) => {
|
|
9
9
|
const [isRestoring, setIsRestoring] = createSignal(true);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const options = createMemo(() => ({
|
|
11
|
+
...props.persistOptions,
|
|
12
|
+
queryClient: props.client
|
|
13
|
+
}));
|
|
14
|
+
createEffect(() => {
|
|
14
15
|
setIsRestoring(true);
|
|
15
|
-
|
|
16
|
-
...props.persistOptions,
|
|
17
|
-
queryClient: props.client
|
|
18
|
-
});
|
|
19
|
-
promise.then(async () => {
|
|
20
|
-
if (isStale)
|
|
21
|
-
return;
|
|
16
|
+
persistQueryClientRestore(options()).then(async () => {
|
|
22
17
|
try {
|
|
23
18
|
await props.onSuccess?.();
|
|
24
19
|
} finally {
|
|
25
20
|
setIsRestoring(false);
|
|
26
21
|
}
|
|
27
22
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
});
|
|
24
|
+
createEffect(() => {
|
|
25
|
+
let unsubscribe = () => {
|
|
31
26
|
};
|
|
32
|
-
|
|
27
|
+
if (!isRestoring()) {
|
|
28
|
+
unsubscribe = persistQueryClientSubscribe(options());
|
|
29
|
+
}
|
|
30
|
+
onCleanup(() => unsubscribe());
|
|
33
31
|
});
|
|
34
|
-
onCleanup(() => _unsubscribe?.());
|
|
35
32
|
return createComponent(QueryClientProvider, {
|
|
36
33
|
get client() {
|
|
37
34
|
return props.client;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query-persist-client",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.2",
|
|
4
4
|
"description": "Solid.js bindings to work with persisters in TanStack/solid-query",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"src"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@tanstack/query-persist-client-core": "5.24.
|
|
47
|
+
"@tanstack/query-persist-client-core": "5.24.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup-preset-solid": "^2.2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"solid-js": "^1.6.0",
|
|
56
|
-
"@tanstack/solid-query": "5.24.
|
|
56
|
+
"@tanstack/solid-query": "5.24.2"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"clean": "rimraf ./build && rimraf ./coverage",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
persistQueryClientRestore,
|
|
3
|
+
persistQueryClientSubscribe,
|
|
4
|
+
} from '@tanstack/query-persist-client-core'
|
|
5
|
+
import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js'
|
|
3
6
|
import { IsRestoringProvider, QueryClientProvider } from '@tanstack/solid-query'
|
|
4
7
|
import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'
|
|
5
8
|
import type { QueryClientProviderProps } from '@tanstack/solid-query'
|
|
@@ -15,33 +18,30 @@ export const PersistQueryClientProvider = (
|
|
|
15
18
|
): JSX.Element => {
|
|
16
19
|
const [isRestoring, setIsRestoring] = createSignal(true)
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
setIsRestoring(true)
|
|
23
|
-
const [unsubscribe, promise] = persistQueryClient({
|
|
24
|
-
...props.persistOptions,
|
|
25
|
-
queryClient: props.client,
|
|
26
|
-
})
|
|
21
|
+
const options = createMemo(() => ({
|
|
22
|
+
...props.persistOptions,
|
|
23
|
+
queryClient: props.client,
|
|
24
|
+
}))
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
createEffect(() => {
|
|
27
|
+
setIsRestoring(true)
|
|
28
|
+
persistQueryClientRestore(options()).then(async () => {
|
|
30
29
|
try {
|
|
31
30
|
await props.onSuccess?.()
|
|
32
31
|
} finally {
|
|
33
32
|
setIsRestoring(false)
|
|
34
33
|
}
|
|
35
34
|
})
|
|
35
|
+
})
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
createEffect(() => {
|
|
38
|
+
let unsubscribe = () => {}
|
|
39
|
+
if (!isRestoring()) {
|
|
40
|
+
unsubscribe = persistQueryClientSubscribe(options())
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
onCleanup(() => unsubscribe())
|
|
42
43
|
})
|
|
43
44
|
|
|
44
|
-
onCleanup(() => _unsubscribe?.())
|
|
45
45
|
return (
|
|
46
46
|
<QueryClientProvider client={props.client}>
|
|
47
47
|
<IsRestoringProvider value={isRestoring}>
|