Skip to content

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Aug 31, 2021

so that we can have intervals dependent on current data / error

so that we can have intervals dependent on current data / error
@vercel
Copy link

vercel bot commented Aug 31, 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/CpE3rkSfacdTniSc2taTcuhiexU9
✅ Preview: https://react-query-git-fork-tkdodo-feature-refetc-3d6a19-tannerlinsley.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 31, 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 5014265:

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

@TkDodo TkDodo marked this pull request as draft August 31, 2021 20:37
add a test for refetch interval function
@TkDodo TkDodo marked this pull request as ready for review September 2, 2021 13:12
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
@TkDodo TkDodo merged commit 9e414e8 into TanStack:master Oct 2, 2021
@TkDodo TkDodo deleted the feature/refetchInterval-function branch October 2, 2021 16:16
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.25.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know a few years have passed and it's too late to say this, but using refetchInterval means using setInterval and it means it is short-polling not a long-polling.

The long-polling uses the Promise answer to set the next call, and it seems RQ hasn't received it yet.

cc: @TkDodo

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