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

docs(useQuery): change isFetching default to false #2071

Merged
merged 2 commits into from
May 7, 2021

Conversation

gornyyvladimir
Copy link
Contributor

Based on this question #624 (comment)
Now isFetching is false when enabled is false

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 1, 2021

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:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@@ -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`
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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 as enabled is set to false

And from this information, I expect isFetching to always be true while enabled false.

Copy link
Collaborator

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.

@vercel
Copy link

vercel bot commented May 7, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/8g7cVHeDXj8t8kaSA99iZeuzHP9m
✅ Preview: https://react-query-git-fork-gornyyvladimir-fix-use-query-typ-530002.vercel.app

@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 3.15.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants