@tanstack/query-core 4.29.15 → 4.29.17
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/lib/infiniteQueryBehavior.d.ts.map +1 -1
- package/build/lib/infiniteQueryBehavior.esm.js +1 -1
- package/build/lib/infiniteQueryBehavior.esm.js.map +1 -1
- package/build/lib/infiniteQueryBehavior.js +1 -1
- package/build/lib/infiniteQueryBehavior.js.map +1 -1
- package/build/lib/infiniteQueryBehavior.mjs +1 -1
- package/build/lib/infiniteQueryBehavior.mjs.map +1 -1
- package/build/lib/query.d.ts.map +1 -1
- package/build/lib/query.esm.js +1 -1
- package/build/lib/query.esm.js.map +1 -1
- package/build/lib/query.js +1 -1
- package/build/lib/query.js.map +1 -1
- package/build/lib/query.mjs +1 -1
- package/build/lib/query.mjs.map +1 -1
- package/build/umd/index.development.js +2 -2
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/infiniteQueryBehavior.ts +5 -1
- package/src/query.ts +3 -1
- package/src/tests/infiniteQueryBehavior.test.tsx +5 -1
- package/src/tests/query.test.tsx +5 -1
package/package.json
CHANGED
|
@@ -44,7 +44,11 @@ export function infiniteQueryBehavior<
|
|
|
44
44
|
|
|
45
45
|
// Get query function
|
|
46
46
|
const queryFn =
|
|
47
|
-
context.options.queryFn ||
|
|
47
|
+
context.options.queryFn ||
|
|
48
|
+
(() =>
|
|
49
|
+
Promise.reject(
|
|
50
|
+
`Missing queryFn for queryKey '${context.options.queryHash}'`,
|
|
51
|
+
))
|
|
48
52
|
|
|
49
53
|
const buildNewPages = (
|
|
50
54
|
pages: unknown[],
|
package/src/query.ts
CHANGED
|
@@ -392,7 +392,9 @@ export class Query<
|
|
|
392
392
|
// Create fetch function
|
|
393
393
|
const fetchFn = () => {
|
|
394
394
|
if (!this.options.queryFn) {
|
|
395
|
-
return Promise.reject(
|
|
395
|
+
return Promise.reject(
|
|
396
|
+
`Missing queryFn for queryKey '${this.options.queryHash}'`,
|
|
397
|
+
)
|
|
396
398
|
}
|
|
397
399
|
this.abortSignalConsumed = false
|
|
398
400
|
return this.options.queryFn(queryFnContext)
|
|
@@ -2,15 +2,18 @@ import { waitFor } from '@testing-library/react'
|
|
|
2
2
|
import type {
|
|
3
3
|
QueryClient,
|
|
4
4
|
InfiniteQueryObserverResult,
|
|
5
|
+
QueryCache,
|
|
5
6
|
} from '@tanstack/query-core'
|
|
6
7
|
import { InfiniteQueryObserver } from '@tanstack/query-core'
|
|
7
8
|
import { createQueryClient, queryKey } from './utils'
|
|
8
9
|
|
|
9
10
|
describe('InfiniteQueryBehavior', () => {
|
|
10
11
|
let queryClient: QueryClient
|
|
12
|
+
let queryCache: QueryCache
|
|
11
13
|
|
|
12
14
|
beforeEach(() => {
|
|
13
15
|
queryClient = createQueryClient()
|
|
16
|
+
queryCache = queryClient.getQueryCache()
|
|
14
17
|
queryClient.mount()
|
|
15
18
|
})
|
|
16
19
|
|
|
@@ -35,9 +38,10 @@ describe('InfiniteQueryBehavior', () => {
|
|
|
35
38
|
})
|
|
36
39
|
|
|
37
40
|
await waitFor(() => {
|
|
41
|
+
const query = queryCache.find(key)!
|
|
38
42
|
return expect(observerResult).toMatchObject({
|
|
39
43
|
isError: true,
|
|
40
|
-
error:
|
|
44
|
+
error: `Missing queryFn for queryKey '${query.queryHash}'`,
|
|
41
45
|
})
|
|
42
46
|
})
|
|
43
47
|
|
package/src/tests/query.test.tsx
CHANGED
|
@@ -794,8 +794,12 @@ describe('query', () => {
|
|
|
794
794
|
})
|
|
795
795
|
|
|
796
796
|
const unsubscribe = observer.subscribe(() => undefined)
|
|
797
|
+
|
|
797
798
|
await sleep(10)
|
|
798
|
-
|
|
799
|
+
const query = queryCache.find(key)!
|
|
800
|
+
expect(mockLogger.error).toHaveBeenCalledWith(
|
|
801
|
+
`Missing queryFn for queryKey '${query.queryHash}'`,
|
|
802
|
+
)
|
|
799
803
|
|
|
800
804
|
unsubscribe()
|
|
801
805
|
})
|