Skip to content

fix: reimbursement validation fixes - #2630

Merged
serikjensen merged 5 commits into
mainfrom
claude/reimbursement-validation-pay-bxwa1a
Aug 25, 2026
Merged

fix: reimbursement validation fixes#2630
serikjensen merged 5 commits into
mainfrom
claude/reimbursement-validation-pay-bxwa1a

Conversation

@serikjensen

@serikjensen serikjensen commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Add validation error for negative reimbursement amounts
  • Fix validation error showing immediately when opening the reimbursement form (errorMessage was passed unconditionally, making the field invalid on mount)

Test plan

  • Open PayrollEditEmployee, click "Add reimbursement" and verify the form opens without errors
  • Click "Save reimbursement" with empty amount and verify "Amount must be greater than zero" displays
  • Enter a valid amount and verify the error clears
  • Enter a negative amount and verify validation triggers
Screen.Recording.2026-08-24.at.4.49.12.PM.mov

🤖 Generated with Claude Code

claude and others added 3 commits August 24, 2026 16:26
Replace raw TextInput with TextInputField for the draft reimbursement
form and add Zod schema validation to reject non-positive amounts. Uses
a separate useForm for the draft row with control passed directly to
TextInputField to avoid conflicting with the parent form's FormProvider.

Previously, entering a negative amount silently failed with no feedback.
Now a clear "Amount must be greater than zero" error is shown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kka7pRSGpL7Ft1vzFMucRg
The errorMessage prop was passed unconditionally, triggering the invalid
state immediately when the form opened. Now it only passes the translated
error when react-hook-form has flagged the amount field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@serikjensen
serikjensen requested a review from a team as a code owner August 24, 2026 22:54

// UseFieldProps.control is typed as unparameterized Control (i.e. Control<FieldValues>),
// which is structurally incompatible with the narrower Control<DraftReimbursementValues>.
const draftControl = draftForm.control as unknown as Control

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Gross, going to have claude look into a resolution

serikjensen and others added 2 commits August 24, 2026 17:54
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the `as unknown as Control` double cast with a nested
FormProvider that scopes the draft form context to its own fields.
The context path in useField only shows errorMessage when there is
a real validation error, so no conditional logic is needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@serikjensen
serikjensen added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 3836b2d Aug 25, 2026
44 checks passed
@serikjensen
serikjensen deleted the claude/reimbursement-validation-pay-bxwa1a branch August 25, 2026 15:47
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.

3 participants