refactor(web): adopt <DataState> in nutrition panels#1713
Conversation
Wrap the nutrition Menu "plan" tab skeleton/card path with the unified <DataState> wrapper so the day-plan generation skeleton flows through the same loading contract that the rest of the web app already uses (initiative 0011 PR 2.6). The visible behaviour is preserved: while `dayPlanBusy` is `true` we render the same SkeletonText + Skeleton + 3x SkeletonMealCard shimmer cluster as before; otherwise <DailyPlanCard /> is rendered with the existing props (including dayPlan/dayPlanBusy so its internal "regenerate meal" affordances keep working). The recipes sub-tab branch is unchanged. Why DataState here (and not, say, in the meal-sheet food search): NutritionApp.tsx is the only consumer in apps/web/src/modules/nutrition that imports the shared <Skeleton> primitives; the food-search `foodBusy`/`offBusy` flags drive inline list states, not panel-level loading swaps, and are already abstracted at the hook layer.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesDay Plan Loading UI Refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
⏱️ CI Pipeline Duration ReportBased on the last 50 successful runs on the default branch. Overall Pipeline
Trend (last 20 runs): Per-Job Breakdown
|
Update initiative 0011 to reflect Phase 2 progress through 2026-05-04: - Status header bumped to include the four open <DataState> consumer PRs: 2.4 #1703 (finyk), 2.5 #1709 (fizruk), 2.6 #1713 (nutrition), 2.7 #1714 (routine). Last-validated handle aligned with the actual initiative owner (@Skords-01). - Phase 2 table column 'Файли (приклад)' renamed to 'Файли (фактичні споживачі)' and ETA column replaced with Status (PR-link). Rows for 2.4–2.7 now point at the actual landed targets, not the initial guess names from the proposal draft (MonoTransactionsPanel, WorkoutHistoryPanel, NutritionMealsPanel, RoutineList, etc. — none of those components physically exist in the repo). - New explanatory note after the table records why the file list diverged from the original draft (real Skeleton-based loading sites per module) and documents the per-module finding for 2.6 / 2.7 (NutritionApp.tsx Menu plan branch; RoutineTimeline.tsx calendar branch — both modules have exactly one consumer of @shared/components/ui/Skeleton). Supersedes #1710 (single doc PR for 2.4 + 2.5 only); this combined update is the cleaner record because all four <DataState> consumer adoption PRs landed on the same day. Closes the doc-side of initiative 0011 PR 2.6 + 2.7.
Summary
Initiative
0011PR 2.6 — adopt the unified<DataState>wrapper insideapps/web/src/modules/nutrition/NutritionApp.tsxfor the Menu "plan" tab.The day-plan generation skeleton (
SkeletonText+Skeletonpill + 3×SkeletonMealCard) used to live in an ad-hoc inline ternary that the rest of the file scrolled through. It now flows through<DataState query={dayPlanQuery} skeleton={dayPlanLoadingSkeleton}>so the loading/empty/data contract matches whatfinyk(PR 2.4) andfizruk(PR 2.5) already do.Visible behaviour is preserved: while
dayPlanBusyistruethe user sees the same shimmering cluster; otherwise<DailyPlanCard />renders with the existing props (includingdayPlananddayPlanBusyso its internal "regenerate meal" affordances keep working). The Recipes sub-tab branch is unchanged.Scope rationale:
NutritionApp.tsxis the only consumer inapps/web/src/modules/nutrition/**that imports@shared/components/ui/Skeleton. The meal-sheet food search (foodBusy/offBusy) drives inline list states inside the search dropdown, not panel-level skeleton swaps, and is already abstracted at the hook layer (useFoodSearch); migrating it would require re-shaping the dropdown UX and is out of scope for this PR.Governing Skill
sergeant-web-uisergeant-feature-deliveryPlaybook
docs/initiatives/0011-foundation-adoption-and-process-discipline.mdPhase 2)<DataState>per the initiative table.Verification
Results:
typecheck: ✅ exit 0 (tsc -p tsconfig.json --noEmit && tsc -p tsconfig.sw.json --noEmit).eslint NutritionApp.tsx: ✅ no warnings, no errors.vitest src/modules/nutrition: ✅ 17 files, 164 / 164 tests passed.Additional checks:
Docs and Governance
AGENTS.mdneeded an update.Updated docs:
docs/initiatives/0011-foundation-adoption-and-process-discipline.md(mirrors the workflow from docs(docs): record 0011 PR 2.4 + 2.5 (DataState adoption) progress #1710 for 2.4 + 2.5).Risk and Rollout
<DailyPlanCard />props, same conditional.<DataState>only short-circuits to skeleton whenquery.data === undefined; withdayPlanBusy ? undefined : dayPlan, that maps 1:1 to the previousdayPlanBusy ? skeleton : cardternary.main. No DB / config / env changes.Hard Rule #15
AGENTS.mdbefore coding.--no-verify.Reviewer Notes
<DataState>contract treatsdata === undefinedas the loading sentinel andnullas a successful "empty" payload. Settingdata: dayPlanBusy ? undefined : dayPlankeeps the original semantics: when not busy anddayPlan === null,<DailyPlanCard />still renders (it owns the "Згенерувати план" empty/initial state itself).useFoodSearch.foodBusy/offBusy) — those drive inline list states inside the meal-sheet search, not panel-level skeleton swaps, and would change UX semantics if wrapped.main(markdown link checker, governance sync, serverapiV1.test.ts, mobilevite buildagainst@sergeant/db-schema/sqlite, Argos visual regression) are unrelated to this change — observed identically on PR 2.4 (refactor(web): adopt <DataState> in finyk Mono panels #1703) and PR 2.5 (refactor(web): adopt <DataState> in fizruk Workouts journal #1709).Summary by cubic
Adopted the unified
DataStatewrapper for the nutrition Menu “plan” tab to standardize loading/empty/data handling. Keeps the same skeleton UI andDailyPlanCardbehavior.DataStateinNutritionApp.tsx, addingdayPlanQueryanddayPlanLoadingSkeleton.DailyPlanCardprops and logic (dayPlan,dayPlanBusy, regenerate meal).Recipessub-tab and food-search inline states unchanged.Written for commit 7d064c7. Summary will update on new commits.
Summary by CodeRabbit