Skip to content

MealList: surface duplicate/edit/replace errors; fix compound-duplicate component fields - #28

Open
KrishP147 wants to merge 1 commit into
mainfrom
krish/fix-meallist-errors
Open

KrishP147 wants to merge 1 commit into
mainfrom
krish/fix-meallist-errors

Conversation

@KrishP147

Copy link
Copy Markdown
Owner

Fixes #7

  • actionError state + role=alert banner with Dismiss at the top of the list; cleared at the start of duplicate/save/replace.
  • Duplicate: components copied with the 5 base_* columns (fiber defaults 0); failed component insert deletes the orphan meal and shows the banner; failed meal insert shows the banner instead of alert().
  • saveEdit: every component update checked, stops on first failure before the meal update; compound + simple meal updates have an else that shows the banner; form stays open.
  • handleReplaceSimpleMeal: checks error, keeps modal open, no local mutation on failure.
  • fetchMeals: early return when no user.
  • Tests: +4 (base_* mapping, orphan rollback, failed save keeps form, no-user empty state). 180/180 locally.

Open follow-ups noted by the manager: fetchMealComponents still returns [] on error; no tests for component-update or replace failure paths. #22 (component_name persist) lands after this.

🤖 Generated with Claude Code

…te fields

- add actionError state + alert banner, cleared per action
- handleDuplicate: guard user, surface insert errors, fix component copy to
  use base_* fields (was calories/protein_g etc, silently dropping data),
  roll back orphan meal if component insert fails
- saveEdit: stop on first component-update error, surface meal-update errors
  on both compound and simple paths, keep editor open on failure
- handleReplaceSimpleMeal: surface update errors, keep modal open on failure
- fetchMeals: bail out early if no user

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

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
nutrisync-frontend Ready Ready Preview Sep 24, 2026 3:23am UTC

Copilot AI lite review requested due to automatic review settings September 24, 2026 03:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.63158% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
frontend/src/components/MealList.jsx 52.63% 18 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch was successfully deployed

1 active deployment
Preview — 8241a2ca Deployed Sep 24, 2026 by vercel[bot]
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.

MealList: duplicate compound meal drops components; edit/save/replace errors swallowed

2 participants