Просмотр исходного кода

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

Futa Arai 4 месяцев назад
Родитель
Сommit
570e94ca8c
1 измененных файлов с 5 добавлено и 1 удалено
  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
     // Update parent attrs
     const ancestorsMap = new Map(); // Map<path, page>
     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 nonRootAncestors = ancestors.filter(page => !isTopPage(page.path));
     const operations = nonRootAncestors.map((page) => {
     const operations = nonRootAncestors.map((page) => {