Ver Fonte

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

fix: test empty page not included on normalize
Haku Mizuki há 4 anos atrás
pai
commit
fca196eb5a
1 ficheiros alterados com 3 adições e 0 exclusões
  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;