-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
docs(useQuery): change isFetching default to false #2071
docs(useQuery): change isFetching default to false #2071
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c329b89:
|
docs/src/pages/reference/useQuery.md
Outdated
@@ -211,7 +211,7 @@ const result = useQuery({ | |||
- Will be `true` if the query has been fetched after the component mounted. | |||
- This property can be used to not show any previously cached data. | |||
- `isFetching: boolean` | |||
- Defaults to `true` so long as `enabled` is set to `false` | |||
- Defaults to `false` so long as `enabled` is set to `false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t understand that sentence at all. isFetching is returned from useQuery - it doesn’t "default" to anything. In my understanding, this flag will always be true whenever a request for this query is in-flight. This includes initial loading as well as background refetches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, maybe better to remove this sentence from docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we can not fetch data while enabled is false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But sentence in docs is:
Defaults to
true
so long asenabled
is set tofalse
And from this information, I expect isFetching to always be true
while enabled false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just change the sentence to:
- `isFetching: boolean`
- this flag is `true` whenever a request is in-flight, which includes initial `loading` as well as background refetches.
you can also change that sentence semantically, but that is what this flag is doing.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/8g7cVHeDXj8t8kaSA99iZeuzHP9m |
🎉 This PR is included in version 3.15.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Based on this question #624 (comment)
Now isFetching is
false
when enabled isfalse