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.

749 B
Raw Blame
import type { QueryClient } from "@tanstack/react-query";
import type { ProjectWithTasks } from "@/types/project";

/** Refresh only cached boards that contain the relation's parent task. */
export function invalidateRelationTaskProject(
  queryClient: QueryClient,
  taskId: string,
) {
  return queryClient.invalidateQueries({
    queryKey: ["tasks"],
    predicate: ({ state }) => {
      const project = state.data as ProjectWithTasks | undefined;
      return Boolean(
        project?.columns.some((column) =>
          column.tasks.some((task) => task.id === taskId),
        ) ||
        project?.plannedTasks?.some((task) => task.id === taskId) ||
        project?.archivedTasks?.some((task) => task.id === taskId),
      );
    },
  });
}