feat(web): migrate dashboard to GET /projects/overview#143
Conversation
Follow-up to the additive /projects/overview endpoint (lee-to#139, merged). Moves the dashboard consumers off the legacy bare GET /tasks (full Task[]) onto the aggregate /overview endpoint. Dashboard migration: - App.tsx: header metrics switch from bare listTasks() + calculateTaskMetrics to useProjectTaskOverviews() + calculateOverviewMetrics. - ProjectsOverview.tsx: card view reads from per-project overviews (statusCounts, statusPreviews, totals) instead of fanning out full lists. - useProjects.ts: add useProjectTaskOverviews hook + invalidateProjectTaskOverviews helper; invalidate overview query on project mutations. - useWebSocket.ts: invalidate overview query on task/roadmap events. - useTasks.ts: drop the no-arg bare listTasks() caller path; list path is scoped-only (TaskListItem[]) for the board. - lib/api.ts: listProjectTaskOverviews method; listTasks(projectId) required (no-arg overload removed — dashboard no longer uses it). - lib/taskMetrics.ts: calculateOverviewMetrics + calculateProjectOverviewMetrics reduce ProjectTaskOverview[] into the dashboard summary. - Tests: AppSmoke asserts overview hook wiring; ProjectsOverview regression test for empty-project loading state; api.test covers the /overview endpoint. Non-breaking: builds on the merged lee-to#139 endpoint. The server bare GET /tasks route stays available (legacy), but the web client no longer calls it. Verification: tsc clean (web); 674 web tests green; prettier/lint/build green.
Code reviewVerdict: REQUEST_CHANGES. This PR is a cohesive UI migration from dashboard-wide bare task fetches to the aggregate Must fix
Should fix
NitsNone. Context gates
Positive note: the empty-project overview regression test is the right kind of coverage for this migration, and the aggregate metric reducer keeps the UI-side calculation small. |
…-limit WS Per lee-to#143 review (REQUEST_CHANGES), two fixes: 1. Must-fix #1 — bare listTasks() URL /tasks/tasks: The retained no-arg overload did request(`${API_BASE}/tasks`) while API_BASE is already '/tasks' (regression re-introduced when migrating files off an older branch state). After the dashboard migrated to /projects/overview, the no-arg path has no remaining caller, so the overload + bare branch are removed entirely. listTasks(projectId) is the only signature now. 2. Must-fix #2 — WS runtime_limit_updated leaves overview metrics stale: project:runtime_limit_updated fired but only invalidated ['tasks'], skipping the new overview query. Since overview aggregates token/cost fields, the dashboard header + project cards showed stale token/cost after usage updates. Add invalidateProjectTaskOverviews(queryClient) in that branch. Regression test: useWebSocketOverviewInvalidation.test pins that invalidateProjectTaskOverviews invalidates ['projectTaskOverviews'], so a future change that drops/renames the query key surfaces immediately. Verification: tsc clean (web); 675 web tests green; prettier/lint/build green.
|
Both must-fix items addressed. Head: Must-fix #1 —
|
Code reviewFollow-up review for the prior comment: #143 (comment) Verdict: APPROVE. This follow-up commit addresses both previously blocking issues without widening the PR scope. The bare no-arg task-list client path is removed, the runtime-limit WebSocket branch now refreshes the new overview query, and the current CI checks are green. Response pass
Must fixNone. Should fix
NitsNone. Context gates
LGTM now. |
Summary
Follow-up to the merged additive
/projects/overviewendpoint (#139). Moves the dashboard consumers off the legacy bareGET /tasks(fullTask[]) onto the aggregate/overviewendpoint.This is the UI-migration step that was deliberately split out of #139 per the review ("keep that PR purely additive"). #139 landed the endpoint; this PR lands the consumer switch.
What's here
Dashboard migration (consume
ProjectTaskOverview[]from/overview):App.tsx: header metrics switch fromapi.listTasks()(bare) +calculateTaskMetrics→useProjectTaskOverviews()+calculateOverviewMetrics.ProjectsOverview.tsx: card view reads per-projectstatusCounts,statusPreviews, and metric totals from the aggregate endpoint instead of fanning out full task lists.useProjects.ts: adduseProjectTaskOverviewshook +invalidateProjectTaskOverviewshelper; invalidate the overview query on project mutations.useWebSocket.ts: invalidate the overview query on task/roadmap events.useTasks.ts: list path is scoped-only (TaskListItem[]); the no-arg bare caller path is removed (the dashboard no longer uses it).lib/api.ts:listProjectTaskOverviewsmethod;listTasks(projectId)now requiresprojectId(no-arg overload removed).lib/taskMetrics.ts:calculateOverviewMetrics+calculateProjectOverviewMetricsreduceProjectTaskOverview[]into the dashboard summary.Tests: AppSmoke asserts overview hook wiring;
ProjectsOverviewregression test for the empty-project loading state;api.testcovers the/overviewendpoint.Merge-safety
Builds on the merged #139 endpoint. The server bare
GET /tasksroute stays available (legacy) — the web client just no longer calls it. After this lands, the bare route's only remaining caller is gone, and a future cleanup PR can remove the dead no-arg client overload / deprecate the server route.Verification
tsc --noEmitclean (web).prettier/lint/buildgreen.