diff --git a/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx b/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx index fdb9db9..e9bcebf 100644 --- a/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx +++ b/frontend/src/components/WorkspaceSidebar/ProjectStructure.tsx @@ -28,7 +28,7 @@ const ItemTypes = { }; export default function ProjectStructure({ project }: { project: Project }) { - const { setProject, setCategories, folderId, setFolderId } = useProjectStore(); + const { setProject, setCategories, setFolderId } = useProjectStore(); const { image: selectedImage, setImage } = useCanvasStore(); const { treeData, fetchNodeData, setTreeData } = useTreeData(project.id.toString()); const { data: categories } = useProjectCategoriesQuery(project.id); @@ -40,24 +40,20 @@ export default function ProjectStructure({ project }: { project: Project }) { const [containerHeight, setContainerHeight] = useState(400); useEffect(() => { - setCategories(categories); + if (categories) { + setCategories(categories); + } }, [categories, setCategories]); useEffect(() => { setProject(project); }, [project, setProject]); - useEffect(() => { - if (treeData) { - setFolderId(folderId); - } - }, [treeData, setFolderId, folderId]); - useEffect(() => { if (containerRef.current) { setContainerHeight(containerRef.current.clientHeight); } - }, [containerRef, treeData, isLoading]); + }, [treeData, isLoading]); const onToggle = useCallback( async (node: TreeNode, toggled: boolean) => {