react-query-questions
solid-query-questions
table-questions
virtual-questions
router-questions
react-charts-questions
ranger-questions
vue-query-questions
svelte-query-questions
bling-questions
form-questions
angular-query-questions
start-questions
db-questions
start-showcase
router-showcase
📣-announcements
Update refetchInterval
revalidateOnWindowFocus question
refetchIntervalInBackground
Avoiding useEffect when data changes
Advice needed: is it still necessary to have service worker and IndexDB if we are using React Query?
Difference between `queryClient.clear()` and `queryClient.resetQueries()`?
queryClient.clear does, which is not very clear at all based on https://tanstack.com/query/v4/docs/react/reference/QueryClient.
The basic use case is:
* User signs out of a mobile app
* Reset all queries, so that data is refetched as an unauthenticated user...Set query data for query with nested array query key
queryKey: ['foo', ['bar']] which I want to update the query data for.
When I do
queryClient.setQueriesData(['foo'], ...)
...set default `exact` option
refetchQueries({ queryKey: [ /* ... */ ], exact: true });
refetchQueries({ queryKey: [ /* ... */ ], exact: true });
Invalidating dependent queries?
queryClient.invalidateQueries() for that, but I can't wrap my head around dealing with the dependent query I have.
I am getting the user's current location with the Geolocation API in a useGeolocationQuery, which is a variable in the dependent useForecastQuery.
When the user presses the refresh button, it should first retry the geolocation query. If this has changed, it will obviously fetch the new forecast. However, if it has not changed, it should still get the latest forecast. The easy solution would be to refetch both queries immediately, but I'm dealing with usage limits so I would really like to avoid fetching the latest forecast for an old location (because the refetches would be parallel)....Invalidate query after mutation
Recommended pattern to compare and select server/local state?
updatedAt. Currently, I have a simple queryFn that just connects to the DB to get the server version and sets that as the query data. Is there a recommended way to compare this version to the local version (for example, an optimistic update pre-mutation success) and keep whichever is more recent? I do not want an automatic refresh to override local content if the local content is more recent.
I want to avoid this:
* User makes edit to form, triggering an optimistic update and a mutation...Queries become inactive and disappear from devtools
Missing queryFn error
change default refetchType
invalidateQueries, one can change the refetchType.
If i always want to do refetchType: "all", is there a way to set it to be the default?...Sharing mutation results across multiple components
Persist wiped every other refresh. Meta not being loaded/persisted?
dev tool not showing in nextjs deployment
Limit number of concurrent queries?
What makes a query "active"
Keep data from last query is the next query fails
