I don't want my components to always refetch when they will mount and already have the query in the cache, so I did:
export const App = ({ props }) => {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
refetchOnMount: false,
},
},
})
return (<QueryClientProvider client={queryClient}>{...restOfMyApp}</QueryClientProvider>)
}
When I save some config I tried to invalidate my query with the first key and with that queryClient.invalidateQueries(). In the React-Query devtools, it did show that the query is invalidated, but it just keeps the same results and don't refetch the query.
How can I invalidate the query to be refetched, but don't have to launch the query everytime the component mounts?
Thank you for your help!