Taichi Masuyama 4 лет назад
Родитель
Сommit
2ccc286dd0
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      packages/app/src/server/models/page.ts
  2. 2 2
      packages/app/src/server/service/page.ts

+ 1 - 1
packages/app/src/server/models/page.ts

@@ -225,7 +225,7 @@ schema.statics.getParentAndFillAncestors = async function(path: string): Promise
   /*
    * Fill parents if parent is null
    */
-  const ancestorPaths = collectAncestorPaths(path); // paths of parents need to be created
+  const ancestorPaths = collectAncestorPaths(path, [path]); // paths of parents need to be created
 
   // just create ancestors with empty pages
   await this.createEmptyPagesByPaths(ancestorPaths);

+ 2 - 2
packages/app/src/server/service/page.ts

@@ -1914,7 +1914,7 @@ class PageService {
     // for updating descendantCount
     const pageIdToExDescendantCount = new Map<ObjectIdLike, number>();
 
-    // migrate recursively
+    // MAIN PROCESS migrate recursively
     try {
       for await (const path of pathsToNormalize) {
         await this.normalizeParentRecursively(null, [new RegExp(`^${escapeStringRegexp(path)}`, 'i')]);
@@ -1931,7 +1931,7 @@ class PageService {
       throw err;
     }
 
-    // update descendantCount
+    // POST MAIN PROCESS update descendantCount
     try {
       for await (const path of pathsToNormalize) {
         await this.updateDescendantCountOfSelfAndDescendants(path);