TanStackT
TanStack3y ago
2 replies
cold-orange

Resolve mutation after invalidating queries

  const { isSuccess, isLoading, isError, mutate, data, error } = useMutation(
    async (e: FormEvent<HTMLFormElement>) => {
      e.preventDefault();
      //fetching some API here
    },
    {
      onSuccess: () => queryClient.invalidateQueries({ queryKey: ["user"] }),
    }
  );

Is it possible to have isLoading flag still equals to true, when mutation completed, but invalidatingQueries is in progress?
Was this page helpful?