-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(useQuery): make refetchInterval accept a function #2622
feat(useQuery): make refetchInterval accept a function #2622
Conversation
so that we can have intervals dependent on current data / error
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/CpE3rkSfacdTniSc2taTcuhiexU9 |
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 5014265:
|
add a test for refetch interval function
treat refetchInterval of 0 the same as false (no interval)
pass the whole query as second argument to refetchInterval function. errors can still be accessed via `query.state.error`, and it will give us access to the queryKey as well (useful for setting up the interval globally in defaultOptions). separating out `data` as separate parameter still makes sense because it will be the observer result (possibly transformed by `select`), while `query.state.data` will be the raw data
always pass nextInterval to updateRefetchInterval
use false as a fallback instead of zero
🎉 This PR is included in version 3.25.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
so that we can have intervals dependent on current data / error