TanStackT
TanStack3mo ago
2 replies
technological-jade

Is it possible to suspend with useSuspenseQuery for all fetches?

I have an updating value that should refetch and I have that as the 2nd queryKey. I want it so that anytime this value is updated, the component suspends. I think the article below has a solution for the useQuery hook, but I want to do something similar with useSuspenseQuery. Checking inside of the component with useIsFetching and returning the suspense fallback doesn't seem like a clean solution to this.

https://tanstack.com/query/latest/docs/framework/react/guides/background-fetching-indicators
A query's status === 'pending' state is sufficient enough to show the initial hard-loading state for a query, but sometimes you may want to display an additional indicator that a query is refetching i...
Background Fetching Indicators | TanStack Query React Docs
Was this page helpful?