don't changed project when move to one page to another page

This commit is contained in:
pramod mahajan 2025-09-05 11:14:02 +05:30
parent 6dfdaf3316
commit cabb1b01c9

View File

@ -7,19 +7,16 @@ import { setProjectId } from "../../slices/localVariablesSlice";
import { useSelectedProject } from "../../slices/apiDataManager";
const TaskPlannng = () => {
const selectedProject = useSelectedProject();
const dispatch = useDispatch();
const { projectNames, loading: projectLoading } = useProjectName();
const selectedProject = useSelectedProject();
const dispatch = useDispatch();
const { projectNames = [], loading: projectLoading } = useProjectName();
const initialized = useRef(false);
useEffect(() => {
if (!selectedProject) {
dispatch(setProjectId(projectNames[0].id));
}
}, [projectNames, selectedProject?.id, dispatch]);
useEffect(() => {
if (!initialized.current && projectNames.length > 0 && !selectedProject?.id) {
debugger
dispatch(setProjectId(projectNames[0].id));
initialized.current = true;
}
}, [projectNames, selectedProject, dispatch]);
return (
<div className="container-fluid">