auto-sync: 2026-05-17 13:23:08

This commit is contained in:
cfdaily
2026-05-17 13:23:08 +08:00
parent cf217ce68d
commit d193f77740
+3 -3
View File
@@ -484,12 +484,12 @@ export const useStore = create<AppStore>((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<AppStore>((set, get) => ({
const detail = await r.json();
return { ...t, ...detail };
}
} catch { /* skip enrichment */ }
} catch { /* skip */ }
return t;
}));
set({ v2tasks: enriched });