Replies: 2 comments 1 reply
-
It's possible to add it at https://github.com/posva/pinia-colada/blob/main/plugins/auto-refetch/src/index.ts#L71 by changing the In what cases does the data change the setting? |
Beta Was this translation helpful? Give feedback.
-
In my case, I'm essentially doing polling by setting the Different use case that shows TanStack Query's implementation's power: const { data, refetch, isFetching } = useQuery({
queryKey: ['flightStatus', flightId],
queryFn: () => fetchFlightStatus(flightId),
refetchInterval: (query) => {
const status = query.state.data?.status
switch (status) {
case 'scheduled':
return 5 * 60 * 1000 // 5 minutes
case 'boarding':
return 60 * 1000 // 1 minute
case 'in_air':
return 30 * 1000 // 30 seconds
case 'landed':
case 'cancelled':
return false // stop polling
default:
return false
}
},
}) I actually like the idea of having the ability to dynamically change the interval rate but I know that's more of a change than just enabling or disabling |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I really would like to be able to do something like:
where I can enable/disable
autoRefetch
based on the latestdata
. Currently, when trying to referencedata
coming back fromuseQuery
, I get aReferenceError: Cannot access 'benefits' before initialization
error.It would be nice to have something like TanStack Query's

refetchInterval
Beta Was this translation helpful? Give feedback.
All reactions