don't changed project when move to one page to another page
This commit is contained in:
parent
6dfdaf3316
commit
cabb1b01c9
@ -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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user