Explorar o código

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

fix: test empty page not included on normalize
Haku Mizuki %!s(int64=4) %!d(string=hai) anos
pai
achega
fca196eb5a
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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;