Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/framework/react/guides/query-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@ Additionally, [Infinite Queries](../infinite-queries) get the following options
- `pageParam: TPageParam`
- the page parameter used to fetch the current page
- `direction: 'forward' | 'backward'`
- **deprecated**
- the direction of the current page fetch
- To get access to the direction of the current page fetch, please add a direction to `pageParam` from `getNextPageParam` and `getPreviousPageParam`.
3 changes: 1 addition & 2 deletions packages/query-core/src/__tests__/queryClient.test-d.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, expectTypeOf, it } from 'vitest'
import { QueryClient } from '../queryClient'
import type { FetchDirection } from '../query'
import type { DataTag, InfiniteData, QueryKey } from '../types'

describe('getQueryData', () => {
Expand Down Expand Up @@ -146,7 +145,7 @@ describe('defaultOptions', () => {
meta: Record<string, unknown> | undefined
signal: AbortSignal
pageParam?: unknown
direction?: FetchDirection
direction?: unknown
}>()
return Promise.resolve('data')
},
Expand Down
10 changes: 9 additions & 1 deletion packages/query-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,20 @@ export type QueryFunctionContext<
signal: AbortSignal
meta: QueryMeta | undefined
pageParam?: unknown
direction?: 'forward' | 'backward'
/**
* @deprecated
* if you want access to the direction, you can add it to the pageParam
*/
direction?: unknown
}
: {
queryKey: TQueryKey
signal: AbortSignal
pageParam: TPageParam
/**
* @deprecated
* if you want access to the direction, you can add it to the pageParam
*/
direction: FetchDirection
meta: QueryMeta | undefined
}
Expand Down