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 }) {
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) => {