Skip to content

Commit

Permalink
fix: deprecate direction passed to QueryFunctionContext
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed May 10, 2024
1 parent 0bb0fa3 commit b9cc9e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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`.
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

0 comments on commit b9cc9e4

Please sign in to comment.