Explorar el Código

Fixed rendering when non-migrated pages found

Taichi Masuyama hace 4 años
padre
commit
b2091b7a0b
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7 1
      packages/app/src/components/Sidebar/PageTree/ItemsTree.tsx

+ 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);
 
   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];
     currentNode.children = ItemNode.generateNodesFromPages(childPages);
 
@@ -37,6 +42,7 @@ const generateInitialNodeAfterResponse = (ancestorsChildren: Record<string, Part
       return paths.includes(node.page.path as string);
     })[0];
     currentNode = nextNode;
+    return true;
   });
 
   return rootNode;