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.

fix(ui): make subtasks appear after creation without refresh (#1084)

Tin Severa5daa49d2791
diff --git a/apps/web/src/hooks/mutations/task/use-create-task.ts b/apps/web/src/hooks/mutations/task/use-create-task.ts
index 04da6fbe5..a1c0f5379 100644
--- a/apps/web/src/hooks/mutations/task/use-create-task.ts
+++ b/apps/web/src/hooks/mutations/task/use-create-task.ts
@@ -1,9 +1,11 @@
-import { useMutation } from "@tanstack/react-query";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
import createTask, {
type CreateTaskRequest,
} from "@/fetchers/task/create-task";
function useCreateTask() {
+ const queryClient = useQueryClient();
+
return useMutation({
mutationFn: ({
title,
@@ -23,6 +25,11 @@ function useCreateTask() {
dueDate ? new Date(dueDate) : undefined,
priority,
),
+ onSuccess: (_data, variables) => {
+ void queryClient.invalidateQueries({
+ queryKey: ["tasks", variables.projectId],
+ });
+ },
});
}