Repository navigation
Fix validation of disabled nutrition goals - #1324
Merged
rolandgeider merged 1 commit intoOct 21, 2026
Merged
rolandgeider merged 1 commit into
rolandgeider merged 1 commit into
Conversation
ucod3
marked this pull request as ready for review
October 21, 2026 01:58
Collaborator
Member
|
thanks! |
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.
Proposed Changes
Saving a nutrition plan is blocked if a goal contains an invalid value and the user then switches goals off. The field disappears, but its validation error still prevents submission.
To reproduce: enable goals, enter
7000for energy, disable goals, and submit. This change lets the plan save with its goals cleared, as intended. It excludes disabled goals from validation and revalidates when the switch changes to clear stale field errors. Re-enabling goals preserves their values and restores validation.Only
PlanForm.tsxand its existing test file change. There are no dependency or backend changes.Related Issue(s)
Related context: #993 and wger-project/wger#1641 established that disabled goals should be cleared from the payload. That issue is already closed; this addresses the remaining validation case rather than claiming to close it again.
Please check that the PR fulfills these requirements
Validation
npm test -- src/components/Nutrition/widgets/forms/PlanForm.test.tsx --maxWorkers=1: 15 passing tests, including editing an existing plan and re-enabling invalid goals.npm run typecheck: passed.npm run lint: no errors, two existing warnings in unrelated files.TZ=<zone> npm run test:coverage -- --maxWorkers=2: 180 files and 1,174 tests passed in each ofUTC,America/Toronto, andAsia/Kolkata.example.comDNS errors also present in the untouched baseline; this PR does not fix those unrelated test requests.git diff --check: passed.A separate Codex reviewer reviewed the exact patch and independently reran the 15 focused tests and typecheck, reporting PASS. This draft is ready for maintainer review; no user-performed code review is claimed.
AI assistance
Implemented, inspected, and tested using the OpenAI Codex agent. The model identity exposed to the implementation session is GPT-6; a more specific serving-model identifier is not available. Independent review also used a separate Codex agent.