소스 검색

fix useEffect condition

Yuki Takei 4 년 전
부모
커밋
598b474dee
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      packages/app/src/components/Sidebar.tsx

+ 5 - 1
packages/app/src/components/Sidebar.tsx

@@ -244,6 +244,10 @@ const Sidebar: FC<Props> = (props: Props) => {
 
   // open/close resizable container
   useEffect(() => {
+    if (!isCollapsed) {
+      return;
+    }
+
     if (isHoverOnResizableContainer) {
       // schedule to open
       timeoutIdRef.current = setTimeout(() => {
@@ -262,7 +266,7 @@ const Sidebar: FC<Props> = (props: Props) => {
       setContentWidth(sidebarMinimizeWidth);
       timeoutIdRef.current = undefined;
     }
-  }, [isHover, isHoverOnResizableContainer, currentProductNavWidth, setContentWidth]);
+  }, [isCollapsed, isHover, isHoverOnResizableContainer, currentProductNavWidth, setContentWidth]);
 
   return (
     <>