fix openening a task by link

This commit is contained in:
Никита Губарь 2024-07-26 15:50:28 +03:00
parent 1d9a47def4
commit 15f8b51327

View File

@ -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]);