fix: Show detailing indicator by including detail tasks in listInitiativeTasks
listInitiativeTasks was filtering out detail tasks server-side, so the detailAgentByPhase mapping could never resolve agent.taskId to a phaseId. Move the filter to client-side (displayTasks) so detail tasks are available for agent mapping but excluded from counts and display grouping.
This commit is contained in:
@@ -132,7 +132,7 @@ export function taskProcedures(publicProcedure: ProcedureBuilder) {
|
||||
.query(async ({ ctx, input }) => {
|
||||
const taskRepository = requireTaskRepository(ctx);
|
||||
const tasks = await taskRepository.findByInitiativeId(input.initiativeId);
|
||||
return tasks.filter((t) => t.category !== 'detail');
|
||||
return tasks;
|
||||
}),
|
||||
|
||||
listPhaseTasks: publicProcedure
|
||||
|
||||
@@ -117,11 +117,17 @@ export function ExecutionTab({
|
||||
);
|
||||
const allTasks = allTasksQuery.data ?? [];
|
||||
|
||||
// Filter out detail tasks for display (counts/grouping), keep allTasks unfiltered for detailAgentByPhase
|
||||
const displayTasks = useMemo(
|
||||
() => allTasks.filter((t) => t.category !== "detail"),
|
||||
[allTasks],
|
||||
);
|
||||
|
||||
// Group tasks and counts by phaseId
|
||||
const { taskCountsByPhase, tasksByPhase } = useMemo(() => {
|
||||
const counts: Record<string, { complete: number; total: number }> = {};
|
||||
const grouped: Record<string, typeof allTasks> = {};
|
||||
for (const task of allTasks) {
|
||||
const grouped: Record<string, typeof displayTasks> = {};
|
||||
for (const task of displayTasks) {
|
||||
const pid = task.phaseId;
|
||||
if (!pid) continue;
|
||||
if (!counts[pid]) counts[pid] = { complete: 0, total: 0 };
|
||||
@@ -131,7 +137,7 @@ export function ExecutionTab({
|
||||
grouped[pid].push(task);
|
||||
}
|
||||
return { taskCountsByPhase: counts, tasksByPhase: grouped };
|
||||
}, [allTasks]);
|
||||
}, [displayTasks]);
|
||||
|
||||
// Map phaseId → most recent active detail agent
|
||||
const detailAgentByPhase = useMemo(() => {
|
||||
|
||||
@@ -58,17 +58,23 @@ function PipelineTabInner({ initiativeId, phases, phasesLoading }: PipelineTabPr
|
||||
const agentsQuery = trpc.listAgents.useQuery();
|
||||
const allAgents = agentsQuery.data ?? [];
|
||||
|
||||
// Group tasks by phaseId
|
||||
// Filter out detail tasks for display (counts/grouping), keep allTasks unfiltered for detailAgentByPhase
|
||||
const displayTasks = useMemo(
|
||||
() => allTasks.filter((t) => t.category !== "detail"),
|
||||
[allTasks],
|
||||
);
|
||||
|
||||
// Group display tasks by phaseId
|
||||
const tasksByPhase = useMemo(() => {
|
||||
const map: Record<string, SerializedTask[]> = {};
|
||||
for (const task of allTasks) {
|
||||
for (const task of displayTasks) {
|
||||
if (task.phaseId) {
|
||||
if (!map[task.phaseId]) map[task.phaseId] = [];
|
||||
map[task.phaseId].push(task);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}, [allTasks]);
|
||||
}, [displayTasks]);
|
||||
|
||||
// Map phaseId → most recent active detail agent
|
||||
const detailAgentByPhase = useMemo(() => {
|
||||
|
||||
Reference in New Issue
Block a user