Explorar el Código

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

fix: test empty page not included on normalize
Haku Mizuki hace 4 años
padre
commit
fca196eb5a
Se han modificado 1 ficheros con 3 adiciones y 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;