diff --git a/docs/src/pages/reference/useQuery.md b/docs/src/pages/reference/useQuery.md index d8a1bc4741..7e091e5e61 100644 --- a/docs/src/pages/reference/useQuery.md +++ b/docs/src/pages/reference/useQuery.md @@ -195,8 +195,9 @@ const result = useQuery({ - The failure count for the query. - Incremented every time the query fails. - Reset to `0` when the query succeeds. -- `refetch: (options: { throwOnError: boolean }) => Promise` +- `refetch: (options: { throwOnError: boolean, cancelRefetch: boolean }) => Promise` - A function to manually refetch the query. - If the query errors, the error will only be logged. If you want an error to be thrown, pass the `throwOnError: true` option + - If `cancelRefetch` is `true`, then the current request will be cancelled before a new request is made - `remove: () => void` - A function to remove the query from the cache. diff --git a/src/core/types.ts b/src/core/types.ts index 7ad1fd1e84..c3c56187f5 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -215,7 +215,9 @@ export interface ResultOptions { throwOnError?: boolean } -export interface RefetchOptions extends ResultOptions {} +export interface RefetchOptions extends ResultOptions { + cancelRefetch?: boolean; +} export interface InvalidateQueryFilters extends QueryFilters { refetchActive?: boolean