From d193f77740244560e0f4b8866d92f923c788be30 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sun, 17 May 2026 13:23:08 +0800 Subject: [PATCH] auto-sync: 2026-05-17 13:23:08 --- src/frontend/src/store.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/store.ts b/src/frontend/src/store.ts index e707363..0ff2957 100644 --- a/src/frontend/src/store.ts +++ b/src/frontend/src/store.ts @@ -484,12 +484,12 @@ export const useStore = create((set, get) => ({ if (!pid) { set({ v2tasks: [] }); return; } set({ v2tasksLoading: true }); try { - // 获取任务列表 const res = await fetch(`/api/projects/${pid}/tasks`); if (!res.ok) { set({ v2tasks: [], v2tasksLoading: false }); return; } const data = await res.json(); const tasks = data.tasks || []; - // 批量获取聚合字段(comments_count, outputs_count, review_status, latest_event) + // 批量获取每个任务的聚合字段 + // TODO: 后端应提供 list?expand=summary 接口,避免 N+1 const enriched = await Promise.all(tasks.map(async (t: any) => { try { const r = await fetch(`/api/projects/${pid}/tasks/${t.id}`); @@ -497,7 +497,7 @@ export const useStore = create((set, get) => ({ const detail = await r.json(); return { ...t, ...detail }; } - } catch { /* skip enrichment */ } + } catch { /* skip */ } return t; })); set({ v2tasks: enriched });