Fix: 사이드바 에러 해결

This commit is contained in:
정현조 2024-10-04 10:03:39 +09:00
parent cee46f5605
commit b02cc20db6

View File

@ -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<number>(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) => {