Skip to content

websocket-invalidate ({refetchType: 'none', cancelRefetch: false}) + refetchInterval => sometimes staleData #7180

Answered by TkDodo
cproinger asked this question in Ideas
Discussion options

You must be logged in to vote
  1. setting cancelRefetch: false does nothing if you combine it with refetchType: 'none'. If you are not refetching, there is nothing to cancel.

  2. your refetchInterval function will stop doing anything when it gets called once where data is fresh. You'll never get another interval then, unless your component re-renders for some other reason. Imo, you should return a longer interval time here (the maximum time where you'd want to see at least one fetch).

invalidations happening between the start of the API-Call and its return are ignored

yes, that's why we default invalidation to cancelRefetch: true, so that a call to invalidateQueries will always be made. But you're actively opting out …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cproinger
Comment options

Answer selected by cproinger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants