Issues_Aug_2W #371
@ -7,19 +7,16 @@ import { setProjectId } from "../../slices/localVariablesSlice";
|
|||||||
import { useSelectedProject } from "../../slices/apiDataManager";
|
import { useSelectedProject } from "../../slices/apiDataManager";
|
||||||
|
|
||||||
const TaskPlannng = () => {
|
const TaskPlannng = () => {
|
||||||
const selectedProject = useSelectedProject();
|
const selectedProject = useSelectedProject();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { projectNames, loading: projectLoading } = useProjectName();
|
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 (
|
return (
|
||||||
<div className="container-fluid">
|
<div className="container-fluid">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user