From 15f8b51327cefdc38f28af1d87789e78cf99400b Mon Sep 17 00:00:00 2001 From: Gubar Nikita Date: Fri, 26 Jul 2024 15:50:28 +0300 Subject: [PATCH] fix openening a task by link --- src/pages/ProjectTracker/ProjectTracker.jsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/pages/ProjectTracker/ProjectTracker.jsx b/src/pages/ProjectTracker/ProjectTracker.jsx index 1e4e75ec..8ef0937f 100644 --- a/src/pages/ProjectTracker/ProjectTracker.jsx +++ b/src/pages/ProjectTracker/ProjectTracker.jsx @@ -53,6 +53,7 @@ export const ProjectTracker = () => { const projectId = useParams(); const taskParams = useParams(); const taskRefs = useRef([]); + const hasRunEffect = useRef(false); const [openColumnSelect, setOpenColumnSelect] = useState({}); const [selectedTab, setSelectedTab] = useState(0); @@ -81,25 +82,15 @@ export const ProjectTracker = () => { }, []); useEffect(() => { - // const observer = new MutationObserver(() => { - // if (taskParams.taskId && taskRefs.current[taskParams.taskId]) { - // taskRefs.current[taskParams.taskId].click(); - // console.log(taskRefs.current[taskParams.taskId]); - // } - // }); - - // observer.observe(document.body, { childList: true, subtree: true }); - - // return () => observer.disconnect(); - if (projectBoard.columns && taskParams.taskId) { + if (projectBoard.columns && taskParams.taskId && !hasRunEffect.current) { for (const column of projectBoard.columns) { const task = column.tasks.find((task) => task.id == taskParams.taskId); if (task) { openTicket(task); + hasRunEffect.current = true; return; } } - console.log(projectBoard); } }, [projectBoard]);