@tanstack/solid-query 5.51.21 → 5.52.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-query",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.52.0",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"src"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@tanstack/query-core": "5.
|
|
47
|
+
"@tanstack/query-core": "5.52.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup-preset-solid": "^2.2.0",
|
|
@@ -1178,7 +1178,7 @@ describe('useInfiniteQuery', () => {
|
|
|
1178
1178
|
expect(abortListeners[callIndex]).not.toHaveBeenCalled()
|
|
1179
1179
|
})
|
|
1180
1180
|
|
|
1181
|
-
it('should not cancel an ongoing fetchNextPage request when another fetchNextPage is invoked if `cancelRefetch: false` is used
|
|
1181
|
+
it('should not cancel an ongoing fetchNextPage request when another fetchNextPage is invoked if `cancelRefetch: false` is used', async () => {
|
|
1182
1182
|
const key = queryKey()
|
|
1183
1183
|
const start = 10
|
|
1184
1184
|
const onAborts: Array<Mock<(...args: Array<any>) => any>> = []
|
|
@@ -2053,7 +2053,10 @@ describe('useInfiniteQuery', () => {
|
|
|
2053
2053
|
|
|
2054
2054
|
const rendered = render(() => <Page />)
|
|
2055
2055
|
|
|
2056
|
-
await waitFor(() =>
|
|
2056
|
+
await waitFor(() => {
|
|
2057
|
+
const statusElement = rendered.getByText('Status: custom client')
|
|
2058
|
+
expect(statusElement).toBeInTheDocument()
|
|
2059
|
+
})
|
|
2057
2060
|
})
|
|
2058
2061
|
|
|
2059
2062
|
it('should work with infiniteQueryOptions', async () => {
|
|
@@ -2079,6 +2082,9 @@ describe('useInfiniteQuery', () => {
|
|
|
2079
2082
|
|
|
2080
2083
|
const rendered = render(() => <Page />)
|
|
2081
2084
|
|
|
2082
|
-
await waitFor(() =>
|
|
2085
|
+
await waitFor(() => {
|
|
2086
|
+
const statusElement = rendered.getByText('Status: 220')
|
|
2087
|
+
expect(statusElement).toBeInTheDocument()
|
|
2088
|
+
})
|
|
2083
2089
|
})
|
|
2084
2090
|
})
|
|
@@ -600,6 +600,7 @@ describe('useQueries', () => {
|
|
|
600
600
|
queryKey: key,
|
|
601
601
|
queryFn: fn
|
|
602
602
|
? (ctx: QueryFunctionContext<TQueryKey>) => {
|
|
603
|
+
// eslint-disable-next-line vitest/valid-expect
|
|
603
604
|
expectTypeOf<TQueryKey>(ctx.queryKey)
|
|
604
605
|
return (fn as QueryFunction<TQueryFnData, TQueryKey>).call(
|
|
605
606
|
{},
|
|
@@ -802,7 +802,7 @@ describe('createQuery', () => {
|
|
|
802
802
|
expect(states[1]).toMatchObject({ data: 'test' })
|
|
803
803
|
})
|
|
804
804
|
|
|
805
|
-
it('should be able to select a part of the data with select in object syntax', async () => {
|
|
805
|
+
it('should be able to select a part of the data with select in object syntax 2', async () => {
|
|
806
806
|
const key = queryKey()
|
|
807
807
|
const states: Array<CreateQueryResult<string>> = []
|
|
808
808
|
|
|
@@ -831,7 +831,7 @@ describe('createQuery', () => {
|
|
|
831
831
|
expect(states[1]).toMatchObject({ data: 'test' })
|
|
832
832
|
})
|
|
833
833
|
|
|
834
|
-
it('should be able to select a part of the data with select in object syntax', async () => {
|
|
834
|
+
it('should be able to select a part of the data with select in object syntax 1', async () => {
|
|
835
835
|
const key = queryKey()
|
|
836
836
|
const states: Array<CreateQueryResult<string>> = []
|
|
837
837
|
|
|
@@ -3754,7 +3754,7 @@ describe('createQuery', () => {
|
|
|
3754
3754
|
expect(results[2]).toMatchObject({ data: 'fetched data', isStale: false })
|
|
3755
3755
|
})
|
|
3756
3756
|
|
|
3757
|
-
it('
|
|
3757
|
+
it('should support enabled:false in query object syntax', async () => {
|
|
3758
3758
|
const key = queryKey()
|
|
3759
3759
|
const queryFn = vi.fn<(...args: Array<unknown>) => string>()
|
|
3760
3760
|
queryFn.mockImplementation(() => 'data')
|
|
@@ -5913,7 +5913,7 @@ describe('createQuery', () => {
|
|
|
5913
5913
|
})
|
|
5914
5914
|
})
|
|
5915
5915
|
|
|
5916
|
-
it('
|
|
5916
|
+
it('should have status=error on mount when a query has failed', async () => {
|
|
5917
5917
|
const key = queryKey()
|
|
5918
5918
|
const states: Array<CreateQueryResult<unknown>> = []
|
|
5919
5919
|
const error = new Error('oops')
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { describe } from '
|
|
2
|
-
import { expectTypeOf, it } from 'vitest'
|
|
1
|
+
import { describe, expectTypeOf, it } from 'vitest'
|
|
3
2
|
import { type InfiniteData, dataTagSymbol } from '@tanstack/query-core'
|
|
4
3
|
import { createInfiniteQuery } from '../createInfiniteQuery'
|
|
5
4
|
import { infiniteQueryOptions } from '../infiniteQueryOptions'
|
|
@@ -24,33 +23,21 @@ describe('infiniteQueryOptions', () => {
|
|
|
24
23
|
})
|
|
25
24
|
|
|
26
25
|
doNotRun(() => {
|
|
27
|
-
expectTypeOf<
|
|
28
|
-
InfiniteData<
|
|
29
|
-
|
|
30
|
-
wow: boolean
|
|
31
|
-
},
|
|
32
|
-
unknown
|
|
33
|
-
>
|
|
34
|
-
>(createInfiniteQuery(() => options).data)
|
|
26
|
+
expectTypeOf(createInfiniteQuery(() => options).data).toEqualTypeOf<
|
|
27
|
+
InfiniteData<{ wow: boolean }, unknown>
|
|
28
|
+
>()
|
|
35
29
|
|
|
36
|
-
expectTypeOf<
|
|
30
|
+
expectTypeOf(options).toMatchTypeOf<
|
|
37
31
|
ReturnType<
|
|
38
32
|
DefinedInitialDataInfiniteOptions<
|
|
39
|
-
{
|
|
40
|
-
wow: boolean
|
|
41
|
-
},
|
|
33
|
+
{ wow: boolean },
|
|
42
34
|
Error,
|
|
43
|
-
InfiniteData<
|
|
44
|
-
{
|
|
45
|
-
wow: boolean
|
|
46
|
-
},
|
|
47
|
-
unknown
|
|
48
|
-
>,
|
|
35
|
+
InfiniteData<{ wow: boolean }, unknown>,
|
|
49
36
|
Array<string>,
|
|
50
37
|
number | undefined
|
|
51
38
|
>
|
|
52
39
|
>
|
|
53
|
-
>(
|
|
40
|
+
>()
|
|
54
41
|
|
|
55
42
|
expectTypeOf(options.queryKey[dataTagSymbol]).toEqualTypeOf<
|
|
56
43
|
InfiniteData<{ wow: boolean }>
|
|
@@ -67,35 +54,21 @@ describe('infiniteQueryOptions', () => {
|
|
|
67
54
|
})
|
|
68
55
|
|
|
69
56
|
doNotRun(() => {
|
|
70
|
-
expectTypeOf<
|
|
71
|
-
() =>
|
|
72
|
-
|
|
73
|
-
{
|
|
74
|
-
wow: boolean
|
|
75
|
-
},
|
|
76
|
-
unknown
|
|
77
|
-
>
|
|
78
|
-
| undefined
|
|
79
|
-
>(() => createInfiniteQuery(() => options).data)
|
|
57
|
+
expectTypeOf(() => createInfiniteQuery(() => options).data).toEqualTypeOf<
|
|
58
|
+
() => InfiniteData<{ wow: boolean }, unknown> | undefined
|
|
59
|
+
>()
|
|
80
60
|
|
|
81
|
-
expectTypeOf<
|
|
61
|
+
expectTypeOf(options).toMatchTypeOf<
|
|
82
62
|
ReturnType<
|
|
83
63
|
UndefinedInitialDataInfiniteOptions<
|
|
84
|
-
{
|
|
85
|
-
wow: boolean
|
|
86
|
-
},
|
|
64
|
+
{ wow: boolean },
|
|
87
65
|
Error,
|
|
88
|
-
InfiniteData<
|
|
89
|
-
{
|
|
90
|
-
wow: boolean
|
|
91
|
-
},
|
|
92
|
-
unknown
|
|
93
|
-
>,
|
|
66
|
+
InfiniteData<{ wow: boolean }, unknown>,
|
|
94
67
|
Array<string>,
|
|
95
68
|
number
|
|
96
69
|
>
|
|
97
70
|
>
|
|
98
|
-
>(
|
|
71
|
+
>()
|
|
99
72
|
|
|
100
73
|
expectTypeOf(options.queryKey[dataTagSymbol]).toEqualTypeOf<
|
|
101
74
|
InfiniteData<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe,
|
|
1
|
+
import { describe, expectTypeOf, it } from 'vitest'
|
|
2
2
|
import { QueryClient, dataTagSymbol, skipToken } from '@tanstack/query-core'
|
|
3
3
|
import { createQuery } from '../createQuery'
|
|
4
4
|
import { queryOptions } from '../queryOptions'
|
|
@@ -41,14 +41,12 @@ describe('queryOptions', () => {
|
|
|
41
41
|
expectTypeOf(data).toEqualTypeOf<number>()
|
|
42
42
|
})
|
|
43
43
|
it('should tag the queryKey with the result type of the QueryFn', () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
queryFn: () => Promise.resolve(5),
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
expectTypeOf(queryKey[dataTagSymbol]).toEqualTypeOf<number>()
|
|
44
|
+
const { queryKey } = queryOptions({
|
|
45
|
+
queryKey: ['key'],
|
|
46
|
+
queryFn: () => Promise.resolve(5),
|
|
51
47
|
})
|
|
48
|
+
|
|
49
|
+
expectTypeOf(queryKey[dataTagSymbol]).toEqualTypeOf<number>()
|
|
52
50
|
})
|
|
53
51
|
it('should tag the queryKey even if no promise is returned', () => {
|
|
54
52
|
const { queryKey } = queryOptions({
|