소스 검색

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

Futa Arai 5 달 전
부모
커밋
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
     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) => {