2
0
Эх сурвалжийг харах

Fixed rendering when non-migrated pages found

Taichi Masuyama 4 жил өмнө
parent
commit
b2091b7a0b

+ 7 - 1
packages/app/src/components/Sidebar/PageTree/ItemsTree.tsx

@@ -29,7 +29,12 @@ const generateInitialNodeAfterResponse = (ancestorsChildren: Record<string, Part
   const paths = Object.keys(ancestorsChildren);
   const paths = Object.keys(ancestorsChildren);
 
 
   let currentNode = rootNode;
   let currentNode = rootNode;
-  paths.forEach((path) => {
+  paths.every((path) => {
+    // stop rendering when non-migrated pages found
+    if (currentNode == null) {
+      return false;
+    }
+
     const childPages = ancestorsChildren[path];
     const childPages = ancestorsChildren[path];
     currentNode.children = ItemNode.generateNodesFromPages(childPages);
     currentNode.children = ItemNode.generateNodesFromPages(childPages);
 
 
@@ -37,6 +42,7 @@ const generateInitialNodeAfterResponse = (ancestorsChildren: Record<string, Part
       return paths.includes(node.page.path as string);
       return paths.includes(node.page.path as string);
     })[0];
     })[0];
     currentNode = nextNode;
     currentNode = nextNode;
+    return true;
   });
   });
 
 
   return rootNode;
   return rootNode;