fix: make managed forms dates optional, adjust payload#976
Conversation
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
📝 WalkthroughWalkthroughThe PR makes sponsor customized form date fields optional by adding conditional validation rules and corresponding normalization guards. The form validation in ChangesOptional Date Fields
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed due to a network error. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form.js (1)
154-171:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove or conditionally set
requiredprop on date pickers.The
requiredprop at lines 160 and 169 shows visual indicators (typically asterisks) that these fields are mandatory. However, the validation schema now allows both fields to be empty. This creates a UX inconsistency where users see required markers but can submit without filling them.Either remove the
requiredprop from both datepickers, or make it conditional based on whether the other field has a value.🛠️ Proposed fix to remove required prop
<Grid2 size={4}> <MuiFormikDatepicker name="opens_at" label={T.translate( "edit_sponsor.forms_tab.customized_form.opens_at" )} - required /> </Grid2> <Grid2 size={4}> <MuiFormikDatepicker name="expires_at" label={T.translate( "edit_sponsor.forms_tab.customized_form.expires_at" )} - required /> </Grid2>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form.js` around lines 154 - 171, The MuiFormikDatepicker components for fields "opens_at" and "expires_at" are marked required but the validation schema permits empties; either remove the required prop from both MuiFormikDatepicker instances (the ones with name="opens_at" and name="expires_at") or make the required prop conditional by reading Formik state (e.g., via useFormikContext or formik props) so required is true only when the counterpart field has a value; update the two occurrences in customized-form.js accordingly to keep the UI consistent with validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@src/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form.js`:
- Around line 154-171: The MuiFormikDatepicker components for fields "opens_at"
and "expires_at" are marked required but the validation schema permits empties;
either remove the required prop from both MuiFormikDatepicker instances (the
ones with name="opens_at" and name="expires_at") or make the required prop
conditional by reading Formik state (e.g., via useFormikContext or formik props)
so required is true only when the counterpart field has a value; update the two
occurrences in customized-form.js accordingly to keep the UI consistent with
validation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ffbb5540-1677-4262-98db-1b012426c504
📒 Files selected for processing (2)
src/actions/sponsor-forms-actions.jssrc/pages/sponsors/sponsor-page/tabs/sponsor-forms-tab/components/customized-form/customized-form.js
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
ref: https://app.clickup.com/t/9014802374/86badfw5a
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit