refetchOneLastTime
option for useQuery
#5880
Unanswered
funwithtriangles
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The problem
I have one part of my app that is checking to see if we should be refetching or not. It tells another part of my app whether to stop refetching. Like this:
The problem I am facing, is that once polling has ended, I need to get one last request to get the final piece of updated data. When
refetchInterval
becomes false, it stops polling (as expected), but I'd love it to trigger one more request.My proposal
When
refetchOneLastTime
is set totrue
, it triggers a query request ifrefetchInterval
goes fromtrue
tofalse
. Obviously the name of this option is up for debate 😛Current workaround
I am able to solve my problem with some custom logic. This hook listens to
isPolling
and refetches based on the query key. It works but is a bit messy.Beta Was this translation helpful? Give feedback.
All reactions