浏览代码

Merge pull request #5499 from weseek/fix/bug-after-normalize

fix: test empty page not included on normalize
Haku Mizuki 4 年之前
父节点
当前提交
fca196eb5a
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      packages/app/src/server/service/page.ts

+ 3 - 0
packages/app/src/server/service/page.ts

@@ -2370,6 +2370,9 @@ class PageService {
       // find pages again to get updated descendantCount
       // then calculate inc
       const pageAfterUpdatingDescendantCount = await Page.findByIdAndViewer(page._id, user);
+      if (pageAfterUpdatingDescendantCount == null) {
+        throw Error('Page not found after updating descendantCount');
+      }
 
       const exDescendantCount = page.descendantCount;
       const newDescendantCount = pageAfterUpdatingDescendantCount.descendantCount;