Fix: preserve split-validation errors on focus change so unbalanced splits stay blocked#96150
Fix: preserve split-validation errors on focus change so unbalanced splits stay blocked#96150MelvinBot wants to merge 1 commit into
Conversation
…gement Co-authored-by: truph01 <truph01@users.noreply.github.com>
|
No code fix is needed — the only failing check is Every completed code check on this PR is green — DetailsWhen I checked, three checks were still running: the two native AdHoc builds ( I also re-verified the fix is sound: To unblock the merge: open the checklist in the PR description and check every box after confirming each item. |
|
@MelvinBot Mark this PR as ready for review |
|
🤖 Done — PR #96150 is now marked Ready for review. |
Explanation of Change
On the Split expense confirmation page, the "sum of splits must equal the total amount" rule was enforced only as a transient
formErrorstring set bySplitBillController. The focus-reset effect inuseFormErrorManagementclears anyformErrorthat isn'tviolations.-prefixed on every focus/validation-state change. Opening the Merchant step and returning toggles focus, soiou.error.invalidSplit(which isn'tviolations.-prefixed) got wiped — and since nothing re-set it, the Split button was no longer blocked and an unbalanced split could be created.This change treats the split-validation errors (
iou.error.invalidSplit,iou.error.invalidSplitParticipants,iou.error.invalidSplitYourself) exactly likeviolations.-prefixed errors in that focus-reset effect: they are no longer cleared on focus changes.SplitBillControllerremains the single owner of these errors and clears them itself once the shares are valid, so the error persists across the Merchant round-trip and only disappears once the split is actually fixed.Fixed Issues
$ #94572
PROPOSAL: #94572 (comment)
Tests
+> Split expense > Manual.0in the split input for each participant. Verify the "The sum of splits must equal the total amount" error appears and Split is blocked.Offline tests
Same as tests — this is pure client-side validation state, no API or optimistic data is involved.
QA Steps
+> Split expense > Manual.0in the split input for each participant. Verify the "The sum of splits must equal the total amount" error appears and Split is blocked.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari