Refetch of all cache keys despite invalidateQueries([key])
Hello,
I am using react-query version 5.55.0
Issue:
Executing my Form and then redirecting via useNavigate from react-router-dom results in a refetch of all defined useFetch hooks in the target destination.
My staleTime and gcTime are defined in the queryClient instance which wrappes my entire Application via the QueryClientProvider.
2 Replies
conscious-sapphireOP•6mo ago
Explicitly using createArtwork = useCreateArtwork(); via export const useCreateArtwork = () => useCreateObject2("artworks", ARTWORKS_LIST_CREATE);
onSubmit ->
createArtwork.mutate(data)
if (redirect) { navigate("/artworks")}
arriving at artworks now triggers both fetches again even though the useCreateArtwork is supposed to explicitly only trigger the invalidation for "artworks".
And there are no similar keys.
wise-white•6mo ago
please post in #react-query-questions