@tanstack/react-query 5.0.0-alpha.5 → 5.0.0-alpha.6

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/react-query",
3
- "version": "5.0.0-alpha.5",
3
+ "version": "5.0.0-alpha.6",
4
4
  "description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "react-error-boundary": "^3.1.4"
36
36
  },
37
37
  "dependencies": {
38
- "@tanstack/query-core": "5.0.0-alpha.5"
38
+ "@tanstack/query-core": "5.0.0-alpha.6"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^18.0.0",
@@ -20,7 +20,23 @@ describe('pageParam', () => {
20
20
  })
21
21
  })
22
22
 
23
- it('there should be no pageParam passed to queryFn of useQuery', () => {
23
+ it('direction should be passed to queryFn of useInfiniteQuery', () => {
24
+ doNotExecute(() => {
25
+ useInfiniteQuery({
26
+ queryKey: ['key'],
27
+ queryFn: ({ direction }) => {
28
+ const result: Expect<
29
+ Equal<'forward' | 'backward', typeof direction>
30
+ > = true
31
+ return result
32
+ },
33
+ defaultPageParam: 1,
34
+ getNextPageParam: () => undefined,
35
+ })
36
+ })
37
+ })
38
+
39
+ it('there should be no pageParam passed to the queryFn of useQuery', () => {
24
40
  doNotExecute(() => {
25
41
  useQuery({
26
42
  queryKey: ['key'],
@@ -32,6 +48,18 @@ describe('pageParam', () => {
32
48
  })
33
49
  })
34
50
 
51
+ it('there should be no direction passed to the queryFn of useQuery', () => {
52
+ doNotExecute(() => {
53
+ useQuery({
54
+ queryKey: ['key'],
55
+ // @ts-expect-error there should be no pageParam passed to queryFn of useQuery
56
+ queryFn: ({ direction }) => {
57
+ return String(direction)
58
+ },
59
+ })
60
+ })
61
+ })
62
+
35
63
  it('defaultPageParam should define type of param passed to queryFunctionContext for fetchInfiniteQuery', () => {
36
64
  doNotExecute(() => {
37
65
  const queryClient = new QueryClient()