From 07110a69dc00cbb2496612316545d746bad63e2c Mon Sep 17 00:00:00 2001 From: JM-Flores Date: Mon, 25 Aug 2025 19:57:09 +0800 Subject: [PATCH] revalidate board when a task is marked as done --- .../[projectId]/[id]/_components/tasks/TaskViewModal.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/codebility/app/home/kanban/[projectId]/[id]/_components/tasks/TaskViewModal.tsx b/apps/codebility/app/home/kanban/[projectId]/[id]/_components/tasks/TaskViewModal.tsx index 978c108c7..a45236041 100644 --- a/apps/codebility/app/home/kanban/[projectId]/[id]/_components/tasks/TaskViewModal.tsx +++ b/apps/codebility/app/home/kanban/[projectId]/[id]/_components/tasks/TaskViewModal.tsx @@ -1,5 +1,6 @@ "use client"; +import { resourceLimits } from "worker_threads"; import { useEffect, useState } from "react"; import Image from "next/image"; import { useRouter } from "next/navigation"; @@ -22,6 +23,7 @@ import { } from "@/components/ui/select"; import { useModal } from "@/hooks/use-modal"; import { useUserStore } from "@/store/codev-store"; +import { useKanbanStore } from "@/store/kanban-store"; import { SkillCategory, Task } from "@/types/home/codev"; import { createClientClientComponent } from "@/utils/supabase/client"; import { set } from "date-fns"; @@ -74,6 +76,8 @@ const TaskViewModal = ({ const canMarkAsDone = user?.role_id === 1 || user?.role_id === 5; const [prLink, setPrLink] = useState(task?.pr_link || ""); + const { fetchBoardData } = useKanbanStore(); + // handle PR link update const handleUpdate = async () => { if (!task) return; @@ -119,8 +123,8 @@ const TaskViewModal = ({ // ✅ Close modal before refreshing onClose(); - //remove refreshing the page, should be handled in action and on should revalidate - /* window.location.href = window.location.pathname + "?t=" + Date.now(); */ + // Refetch the board data + await fetchBoardData(); } else { toast.error(result.error || "Failed to complete task"); }