TanStackT
TanStack2y ago
4 replies
slow-yellow

Prevent Refetch on invalidateQueries() unless certain time has past.

My use case is I have a SignalR message that comes in that tells me when I should Refetch the page. So I call invalidateQueries each time. The problem is this can occur hundreds of times per second. By default it cancels existing queries which manifests itself by making the UI never refresh until there is no more messages for a while.

I set the cancelRefetch to false. This kind of does what I want but there is no way to set an interval.

Maybe there is a better way to do this. I basically need to disable refetchInterval when there hasn't been any SignalR messages within the last 1 second.
Was this page helpful?