fix(plan): fix Plan page blank — response shape mismatch - #63
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Plan page showing only a blank heading after creating a workout plan.
Root cause:
getCurrentPlanreturned a flatWorkoutPlan & { latestVersion }object, but the frontend'sCurrentPlanResponseexpected{ plan: WorkoutPlan, latestVersion: PlanVersion }(nested). This causeddata?.data?.planto always beundefined→ page rendered neither the empty state nor the populated state.Fix: Changed
getCurrentPlanto 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
{ data: { plan: {...}, latestVersion: {...} } }shape (verified via curl)🤖 Generated with Claude Code