Merge branch 'fe/fix/side-bar' into 'fe/develop'

Fix : 사이드바

See merge request s11-s-project/S11P21S002!277
This commit is contained in:
조현수 2024-10-04 10:14:16 +09:00
commit 1d3c9c4a69

View File

@ -28,7 +28,7 @@ const ItemTypes = {
}; };
export default function ProjectStructure({ project }: { project: Project }) { export default function ProjectStructure({ project }: { project: Project }) {
const { setProject, setCategories, folderId, setFolderId } = useProjectStore(); const { setProject, setCategories, setFolderId } = useProjectStore();
const { image: selectedImage, setImage } = useCanvasStore(); const { image: selectedImage, setImage } = useCanvasStore();
const { treeData, fetchNodeData, setTreeData } = useTreeData(project.id.toString()); const { treeData, fetchNodeData, setTreeData } = useTreeData(project.id.toString());
const { data: categories } = useProjectCategoriesQuery(project.id); const { data: categories } = useProjectCategoriesQuery(project.id);
@ -40,24 +40,20 @@ export default function ProjectStructure({ project }: { project: Project }) {
const [containerHeight, setContainerHeight] = useState<number>(400); const [containerHeight, setContainerHeight] = useState<number>(400);
useEffect(() => { useEffect(() => {
if (categories) {
setCategories(categories); setCategories(categories);
}
}, [categories, setCategories]); }, [categories, setCategories]);
useEffect(() => { useEffect(() => {
setProject(project); setProject(project);
}, [project, setProject]); }, [project, setProject]);
useEffect(() => {
if (treeData) {
setFolderId(folderId);
}
}, [treeData, setFolderId, folderId]);
useEffect(() => { useEffect(() => {
if (containerRef.current) { if (containerRef.current) {
setContainerHeight(containerRef.current.clientHeight); setContainerHeight(containerRef.current.clientHeight);
} }
}, [containerRef, treeData, isLoading]); }, [treeData, isLoading]);
const onToggle = useCallback( const onToggle = useCallback(
async (node: TreeNode, toggled: boolean) => { async (node: TreeNode, toggled: boolean) => {