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

Conversation

dpyzo0o
Copy link
Contributor

@dpyzo0o dpyzo0o commented Jul 1, 2020

enabled can also be used for dependent queries, thus it's not restricted to boolean

@MichaelDeBoey
Copy link
Collaborator

@dpyzo0o Can you give a little bit more explanation please?

@dpyzo0o
Copy link
Contributor Author

dpyzo0o commented Jul 1, 2020

@MichaelDeBoey As described here in the docs, enabled is used as a dep to run the query, it could literally be any type. Also see the source code here
https://github.com/tannerlinsley/react-query/blob/ef1d0d512f3de769b71487650c98a3d56881ce3c/src/react/useBaseQuery.js#L40
whenever enabled changes, the instance will rerun the query.

@tannerlinsley
Copy link
Collaborator

I'm not sure what it should be in TS, but technically it can be anything that can be used to pass a boolean condition

types/index.d.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@MichaelDeBoey
Copy link
Collaborator

@dpyzo0o CI seems to fail.
Please take a look at it 🙂

@dpyzo0o
Copy link
Contributor Author

dpyzo0o commented Jul 3, 2020

@dpyzo0o CI seems to fail.
Please take a look at it 🙂

I have no idea why it failed. The type change should not break the tests. I have run yarn test:ci locally and it passed.

@MichaelDeBoey
Copy link
Collaborator

@tannerlinsley I'm not confident enough to merge this with failing CI.
I'll leave this one up to you

@tannerlinsley tannerlinsley merged commit 8efa46c into TanStack:master Jul 3, 2020
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 2.4.13 🎉

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