Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): useQuery enabled can be any type #679

Merged
merged 1 commit into from
Jul 3, 2020
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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ $ npm i --save react-query
$ yarn add react-query
```


# Defaults to keep in mind

Out of the box, React Query is configured with **aggressive but sane** defaults. **Sometimes these defaults can catch new users off guard or make learning/debugging difficult if they are unknown by the user.** Keep them in mind as you continue to learn and use React Query:
Expand Down Expand Up @@ -1041,7 +1040,7 @@ import { ReactQueryConfigProvider } from 'react-query'
const queryConfig = {
shared: {
suspense: true,
}
},
}

function App() {
Expand Down Expand Up @@ -1772,8 +1771,9 @@ const queryInfo = useQuery({
- Receives the following variables in the order that they are provided:
- Query Key Variables
- Must return a promise that will either resolves data or throws an error.
- `enabled: Boolean`
- `enabled: Boolean | unknown`
- Set this to `false` to disable this query from automatically running.
- Actually it can be anything that will pass a boolean condition. See [Dependent Queries](#dependent-queries) for more information.
- `retry: Boolean | Int | Function(failureCount, error) => shouldRetry | Boolean`
- If `false`, failed queries will not retry by default.
- If `true`, failed queries will retry infinitely.
Expand Down Expand Up @@ -2475,6 +2475,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export interface BaseQueryOptions<TResult = unknown, TError = Error> {
* Set this to `false` to disable automatic refetching when the query mounts or changes query keys.
* To refetch the query, use the `refetch` method returned from the `useQuery` instance.
*/
enabled?: boolean
enabled?: boolean | unknown
/**
* If `false`, failed queries will not retry by default.
* If `true`, failed queries will retry infinitely., failureCount: num
Expand Down