Skip to content

fix(plan): fix Plan page blank — response shape mismatch - #63

Merged
silver-snoopy merged 1 commit into
masterfrom
fix/plan-page-response-shape
Apr 12, 2026
Merged

fix(plan): fix Plan page blank — response shape mismatch#63
silver-snoopy merged 1 commit into
masterfrom
fix/plan-page-response-shape

Conversation

@silver-snoopy

Copy link
Copy Markdown
Owner

Summary

Fixes the Plan page showing only a blank heading after creating a workout plan.

Root cause: getCurrentPlan returned a flat WorkoutPlan & { latestVersion } object, but the frontend's CurrentPlanResponse expected { plan: WorkoutPlan, latestVersion: PlanVersion } (nested). This caused data?.data?.plan to always be undefined → page rendered neither the empty state nor the populated state.

Fix: Changed getCurrentPlan to return { plan, latestVersion } (nested object) instead of { ...plan, latestVersion } (spread merge). Updated the route test mock to match.

How this happened

The backend query module was written by one subagent and the frontend types by another during the original Plan Tuner implementation (PR #60). E2E tests passed because they used mocked fixtures that had the correct nested shape — the real backend never hit the same code path during testing.

Test plan

  • 411 backend tests pass (mock updated to match new shape)
  • 74 frontend tests pass
  • Manual browser verification: Plan page now renders plan data, version cards, exercise table
  • API returns correct { data: { plan: {...}, latestVersion: {...} } } shape (verified via curl)

🤖 Generated with Claude Code

…n, latestVersion }

The GET /api/workout-plans/current endpoint returned a flat
WorkoutPlan & { latestVersion } merge, but the frontend's
CurrentPlanResponse expected { plan: WorkoutPlan, latestVersion }.
This caused planResponse?.plan to always be undefined, making the
Plan page show an empty heading with no content.

Fix: return { plan, latestVersion } (nested) from getCurrentPlan
instead of { ...plan, latestVersion } (flat merge).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
vitals Ignored Ignored Apr 12, 2026 9:52am

@silver-snoopy
silver-snoopy merged commit 96b7207 into master Apr 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant