Parcourir la source

fix setisOpen timing

reiji-h il y a 1 an
Parent
commit
e43904b79e
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      apps/app/src/client/components/TreeItem/TreeItemLayout.tsx

+ 2 - 2
apps/app/src/client/components/TreeItem/TreeItemLayout.tsx

@@ -85,8 +85,8 @@ export const TreeItemLayout = (props: TreeItemLayoutProps): JSX.Element => {
   // didMount
   // didMount
   useEffect(() => {
   useEffect(() => {
     const isPathToTarget = page.path != null && targetPath.startsWith(page.path) && targetPath !== page.path; // Target Page does not need to be opened
     const isPathToTarget = page.path != null && targetPath.startsWith(page.path) && targetPath !== page.path; // Target Page does not need to be opened
-    if (hasChildren() || isPathToTarget) setIsOpen(true);
-  }, [hasChildren, targetPath, page.path]);
+    if (isPathToTarget) setIsOpen(true);
+  }, [targetPath, page.path]);
 
 
   /*
   /*
    * When swr fetch succeeded
    * When swr fetch succeeded