diff --git a/src/frontend/src/store.ts b/src/frontend/src/store.ts index 07a9bea..66787af 100644 --- a/src/frontend/src/store.ts +++ b/src/frontend/src/store.ts @@ -476,7 +476,20 @@ export const useStore = create((set, get) => ({ // v2.6: 加载任务详情(expand=all) loadV2TaskDetail: async (taskId: string) => { const pid = get().selectedProjectId; - if (!pid) return; + if (!pid) { + // 全部任务模式:从 v2tasks 中找任务的 _projectId + const task = (get().v2tasks || []).find((t: any) => t.id === taskId); + if (task && (task as any)._projectId) { + try { + const res = await fetch(`/api/projects/${(task as any)._projectId}/tasks/${taskId}?expand=all`); + if (res.ok) { + const detail = await res.json(); + set({ v2taskDetail: { ...detail, _projectId: (task as any)._projectId } }); + } + } catch { /* silently fail */ } + } + return; + } try { const res = await fetch(`/api/projects/${pid}/tasks/${taskId}?expand=all`); if (res.ok) {