Browse Source

fix non-autofixable biome error (unnecessary return in loop)

Futa Arai 4 months ago
parent
commit
570e94ca8c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      apps/app/src/server/service/page/index.ts

+ 5 - 1
apps/app/src/server/service/page/index.ts

@@ -3561,7 +3561,11 @@ class PageService implements IPageService {
 
     // Update parent attrs
     const ancestorsMap = new Map(); // Map<path, page>
-    ancestors.forEach(page => !ancestorsMap.has(page.path) && ancestorsMap.set(page.path, page)); // the earlier element should be the true ancestor
+    for (const ancestor of ancestors) {
+      if (!ancestorsMap.has(ancestor.path)) {
+        ancestorsMap.set(ancestor.path, ancestor); // the earlier element should be the true ancestor
+      }
+    }
 
     const nonRootAncestors = ancestors.filter(page => !isTopPage(page.path));
     const operations = nonRootAncestors.map((page) => {