Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

645 B
Raw Blame
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useBoardProgress } from "./board-progress";
import { tasksQueryOptions } from "./tasks-query-options";

export function useGetTasks(
  projectId: string,
  { refetchOnMount = true }: { refetchOnMount?: boolean } = {},
) {
  const queryClient = useQueryClient();
  const progress = useBoardProgress(projectId);
  const query = useQuery({
    ...tasksQueryOptions(queryClient, projectId),
    refetchOnMount,
    refetchOnWindowFocus: true,
    enabled: !!projectId,
  });
  return {
    ...query,
    data: query.data ?? (query.isFetching ? progress : undefined),
  };
}