@tanstack/solid-query 5.75.5 → 5.75.7
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 +8 -12
- package/build/dev.js +7 -11
- package/build/index.cjs +8 -12
- package/build/index.js +7 -11
- package/package.json +4 -3
- package/src/useBaseQuery.ts +2 -3
- package/src/useMutation.ts +2 -2
- package/src/utils.ts +0 -12
package/build/dev.cjs
CHANGED
|
@@ -31,16 +31,6 @@ exports.QueryClientProvider = (props) => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
// src/utils.ts
|
|
36
|
-
function shouldThrowError(throwError, params) {
|
|
37
|
-
if (typeof throwError === "function") {
|
|
38
|
-
return throwError(...params);
|
|
39
|
-
}
|
|
40
|
-
return !!throwError;
|
|
41
|
-
}
|
|
42
|
-
function noop() {
|
|
43
|
-
}
|
|
44
34
|
var IsRestoringContext = solidJs.createContext(() => false);
|
|
45
35
|
exports.useIsRestoring = () => solidJs.useContext(IsRestoringContext);
|
|
46
36
|
exports.IsRestoringProvider = IsRestoringContext.Provider;
|
|
@@ -184,7 +174,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
184
174
|
unsubscribe = createClientSubscriber();
|
|
185
175
|
}
|
|
186
176
|
obs.updateResult();
|
|
187
|
-
if (observerResult.isError && !observerResult.isFetching && !isRestoring() && shouldThrowError(obs.options.throwOnError, [
|
|
177
|
+
if (observerResult.isError && !observerResult.isFetching && !isRestoring() && queryCore.shouldThrowError(obs.options.throwOnError, [
|
|
188
178
|
observerResult.error,
|
|
189
179
|
obs.getCurrentQuery()
|
|
190
180
|
])) {
|
|
@@ -312,6 +302,12 @@ function useInfiniteQuery(options, queryClient) {
|
|
|
312
302
|
queryClient
|
|
313
303
|
);
|
|
314
304
|
}
|
|
305
|
+
|
|
306
|
+
// src/utils.ts
|
|
307
|
+
function noop() {
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/useMutation.ts
|
|
315
311
|
function useMutation(options, queryClient) {
|
|
316
312
|
const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
|
|
317
313
|
const observer = new queryCore.MutationObserver(
|
|
@@ -333,7 +329,7 @@ function useMutation(options, queryClient) {
|
|
|
333
329
|
solidJs.on(
|
|
334
330
|
() => state.status,
|
|
335
331
|
() => {
|
|
336
|
-
if (state.isError && shouldThrowError(observer.options.throwOnError, [state.error])) {
|
|
332
|
+
if (state.isError && queryCore.shouldThrowError(observer.options.throwOnError, [state.error])) {
|
|
337
333
|
throw state.error;
|
|
338
334
|
}
|
|
339
335
|
}
|
package/build/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutationObserver, QueriesObserver, QueryClient as QueryClient$1, replaceEqualDeep, hydrate, notifyManager, QueryObserver, InfiniteQueryObserver } from '@tanstack/query-core';
|
|
1
|
+
import { MutationObserver, shouldThrowError, QueriesObserver, QueryClient as QueryClient$1, replaceEqualDeep, hydrate, notifyManager, QueryObserver, InfiniteQueryObserver } from '@tanstack/query-core';
|
|
2
2
|
export * from '@tanstack/query-core';
|
|
3
3
|
import { createContext, useContext, createRenderEffect, onCleanup, createMemo, createComputed, on, mergeProps, createResource, batch, onMount, createSignal, createEffect } from 'solid-js';
|
|
4
4
|
import { createComponent, isServer } from 'solid-js/web';
|
|
@@ -30,16 +30,6 @@ var QueryClientProvider = (props) => {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
// src/utils.ts
|
|
35
|
-
function shouldThrowError(throwError, params) {
|
|
36
|
-
if (typeof throwError === "function") {
|
|
37
|
-
return throwError(...params);
|
|
38
|
-
}
|
|
39
|
-
return !!throwError;
|
|
40
|
-
}
|
|
41
|
-
function noop() {
|
|
42
|
-
}
|
|
43
33
|
var IsRestoringContext = createContext(() => false);
|
|
44
34
|
var useIsRestoring = () => useContext(IsRestoringContext);
|
|
45
35
|
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
@@ -311,6 +301,12 @@ function useInfiniteQuery(options, queryClient) {
|
|
|
311
301
|
queryClient
|
|
312
302
|
);
|
|
313
303
|
}
|
|
304
|
+
|
|
305
|
+
// src/utils.ts
|
|
306
|
+
function noop() {
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/useMutation.ts
|
|
314
310
|
function useMutation(options, queryClient) {
|
|
315
311
|
const client = createMemo(() => useQueryClient(queryClient?.()));
|
|
316
312
|
const observer = new MutationObserver(
|
package/build/index.cjs
CHANGED
|
@@ -31,16 +31,6 @@ exports.QueryClientProvider = (props) => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
// src/utils.ts
|
|
36
|
-
function shouldThrowError(throwError, params) {
|
|
37
|
-
if (typeof throwError === "function") {
|
|
38
|
-
return throwError(...params);
|
|
39
|
-
}
|
|
40
|
-
return !!throwError;
|
|
41
|
-
}
|
|
42
|
-
function noop() {
|
|
43
|
-
}
|
|
44
34
|
var IsRestoringContext = solidJs.createContext(() => false);
|
|
45
35
|
exports.useIsRestoring = () => solidJs.useContext(IsRestoringContext);
|
|
46
36
|
exports.IsRestoringProvider = IsRestoringContext.Provider;
|
|
@@ -175,7 +165,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
175
165
|
unsubscribe = createClientSubscriber();
|
|
176
166
|
}
|
|
177
167
|
obs.updateResult();
|
|
178
|
-
if (observerResult.isError && !observerResult.isFetching && !isRestoring() && shouldThrowError(obs.options.throwOnError, [
|
|
168
|
+
if (observerResult.isError && !observerResult.isFetching && !isRestoring() && queryCore.shouldThrowError(obs.options.throwOnError, [
|
|
179
169
|
observerResult.error,
|
|
180
170
|
obs.getCurrentQuery()
|
|
181
171
|
])) {
|
|
@@ -303,6 +293,12 @@ function useInfiniteQuery(options, queryClient) {
|
|
|
303
293
|
queryClient
|
|
304
294
|
);
|
|
305
295
|
}
|
|
296
|
+
|
|
297
|
+
// src/utils.ts
|
|
298
|
+
function noop() {
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/useMutation.ts
|
|
306
302
|
function useMutation(options, queryClient) {
|
|
307
303
|
const client = solidJs.createMemo(() => exports.useQueryClient(queryClient?.()));
|
|
308
304
|
const observer = new queryCore.MutationObserver(
|
|
@@ -324,7 +320,7 @@ function useMutation(options, queryClient) {
|
|
|
324
320
|
solidJs.on(
|
|
325
321
|
() => state.status,
|
|
326
322
|
() => {
|
|
327
|
-
if (state.isError && shouldThrowError(observer.options.throwOnError, [state.error])) {
|
|
323
|
+
if (state.isError && queryCore.shouldThrowError(observer.options.throwOnError, [state.error])) {
|
|
328
324
|
throw state.error;
|
|
329
325
|
}
|
|
330
326
|
}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutationObserver, QueriesObserver, QueryClient as QueryClient$1, replaceEqualDeep, hydrate, notifyManager, QueryObserver, InfiniteQueryObserver } from '@tanstack/query-core';
|
|
1
|
+
import { MutationObserver, shouldThrowError, QueriesObserver, QueryClient as QueryClient$1, replaceEqualDeep, hydrate, notifyManager, QueryObserver, InfiniteQueryObserver } from '@tanstack/query-core';
|
|
2
2
|
export * from '@tanstack/query-core';
|
|
3
3
|
import { createContext, useContext, createRenderEffect, onCleanup, createMemo, createComputed, on, mergeProps, createResource, batch, onMount, createSignal, createEffect } from 'solid-js';
|
|
4
4
|
import { createComponent, isServer } from 'solid-js/web';
|
|
@@ -30,16 +30,6 @@ var QueryClientProvider = (props) => {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
// src/utils.ts
|
|
35
|
-
function shouldThrowError(throwError, params) {
|
|
36
|
-
if (typeof throwError === "function") {
|
|
37
|
-
return throwError(...params);
|
|
38
|
-
}
|
|
39
|
-
return !!throwError;
|
|
40
|
-
}
|
|
41
|
-
function noop() {
|
|
42
|
-
}
|
|
43
33
|
var IsRestoringContext = createContext(() => false);
|
|
44
34
|
var useIsRestoring = () => useContext(IsRestoringContext);
|
|
45
35
|
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
@@ -302,6 +292,12 @@ function useInfiniteQuery(options, queryClient) {
|
|
|
302
292
|
queryClient
|
|
303
293
|
);
|
|
304
294
|
}
|
|
295
|
+
|
|
296
|
+
// src/utils.ts
|
|
297
|
+
function noop() {
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// src/useMutation.ts
|
|
305
301
|
function useMutation(options, queryClient) {
|
|
306
302
|
const client = createMemo(() => useQueryClient(queryClient?.()));
|
|
307
303
|
const observer = new MutationObserver(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query",
|
|
3
|
-
"version": "5.75.
|
|
3
|
+
"version": "5.75.7",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,14 +46,15 @@
|
|
|
46
46
|
"!src/__tests__"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@tanstack/query-core": "5.75.
|
|
49
|
+
"@tanstack/query-core": "5.75.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@solidjs/testing-library": "^0.8.10",
|
|
53
53
|
"npm-run-all2": "^5.0.0",
|
|
54
54
|
"solid-js": "^1.9.5",
|
|
55
55
|
"tsup-preset-solid": "^2.2.0",
|
|
56
|
-
"vite-plugin-solid": "^2.11.6"
|
|
56
|
+
"vite-plugin-solid": "^2.11.6",
|
|
57
|
+
"@tanstack/query-test-utils": "0.0.0"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"solid-js": "^1.6.0"
|
package/src/useBaseQuery.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Had to disable the lint rule because isServer type is defined as false
|
|
2
2
|
// in solid-js/web package. I'll create a GitHub issue with them to see
|
|
3
3
|
// why that happens.
|
|
4
|
-
import { hydrate, notifyManager } from '@tanstack/query-core'
|
|
4
|
+
import { hydrate, notifyManager, shouldThrowError } from '@tanstack/query-core'
|
|
5
5
|
import { isServer } from 'solid-js/web'
|
|
6
6
|
import {
|
|
7
7
|
createComputed,
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
} from 'solid-js'
|
|
14
14
|
import { createStore, reconcile, unwrap } from 'solid-js/store'
|
|
15
15
|
import { useQueryClient } from './QueryClientProvider'
|
|
16
|
-
import { shouldThrowError } from './utils'
|
|
17
16
|
import { useIsRestoring } from './isRestoring'
|
|
18
17
|
import type { UseBaseQueryOptions } from './types'
|
|
19
18
|
import type { Accessor, Signal } from 'solid-js'
|
|
@@ -230,7 +229,7 @@ export function useBaseQuery<
|
|
|
230
229
|
Fixes #7275
|
|
231
230
|
In a few cases, the observer could unmount before the resource is loaded.
|
|
232
231
|
This leads to Suspense boundaries to be suspended indefinitely.
|
|
233
|
-
This resolver will be called when the observer is unmounting
|
|
232
|
+
This resolver will be called when the observer is unmounting
|
|
234
233
|
but the resource is still in a loading state
|
|
235
234
|
*/
|
|
236
235
|
let resolver: ((value: ResourceData) => void) | null = null
|
package/src/useMutation.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MutationObserver } from '@tanstack/query-core'
|
|
1
|
+
import { MutationObserver, shouldThrowError } from '@tanstack/query-core'
|
|
2
2
|
import { createComputed, createMemo, on, onCleanup } from 'solid-js'
|
|
3
3
|
import { createStore } from 'solid-js/store'
|
|
4
4
|
import { useQueryClient } from './QueryClientProvider'
|
|
5
|
-
import { noop
|
|
5
|
+
import { noop } from './utils'
|
|
6
6
|
import type { DefaultError } from '@tanstack/query-core'
|
|
7
7
|
import type { QueryClient } from './QueryClient'
|
|
8
8
|
import type {
|
package/src/utils.ts
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
export function shouldThrowError<T extends (...args: Array<any>) => boolean>(
|
|
2
|
-
throwError: boolean | T | undefined,
|
|
3
|
-
params: Parameters<T>,
|
|
4
|
-
): boolean {
|
|
5
|
-
// Allow throwError function to override throwing behavior on a per-error basis
|
|
6
|
-
if (typeof throwError === 'function') {
|
|
7
|
-
return throwError(...params)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return !!throwError
|
|
11
|
-
}
|
|
12
|
-
|
|
13
1
|
export function noop(): void {}
|