You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense #99042
Version Number: 9.4.57-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#97020 Email or phone of affected tester (no customers):fischer9966+082026+97020@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iPhone 17 Pro / iOS 26.6 App Component: Left Hand Navigation (LHN)
Action Performed:
Open Expensify App
Login with any account
Step 9 in PR > Tap the FAB > Create expense > Manual. Tap only the +/- key without typing a digit, then swipe back. Verify the discard modal appears.
Expected Result:
Discard modal appears after swipe back if only +/- was entered when creating a manual expense
Actual Result:
Discard modal does NOT appear after swipe back if only +/- was entered when creating a manual expense
Tapping only the +/- key on the manual amount screen flips the visible sign but reports an empty change signal, so the screen never registers as "dirty" and the discard guard is never armed.
When the sign is toggled, toggleNegative reports the newly-signed value to the amount step. But it gates the sign on the number being non-empty:
With no digit typed, currentNumber is '', so currentNumber && nextIsNegative is falsy and the reported value is '' — the sign is dropped. That '' is mirrored into typedAmount at IOURequestStepAmount.tsx:318, and the create-entry dirtiness check reads it as clean:
MoneyRequestUtils.ts:210-211 — return typedAmount !== '' || committedAmount !== 0 || currencyChanged; → '' !== '' (false) || 0 !== 0 (false) || false → not dirty. getHasUnsavedChanges() returns false, so the discard guard's beforeRemove returns early and navigation proceeds with no modal.
This regressed in PR #97020, which reworked the discard guard to arm only when the screen has unsaved changes. Its own test step 9 is exactly this scenario. The bug is App-only (iOS/Android) — not desktop web — because the +/- key is part of the touch-only BigNumberPad (shouldShowBigNumberPad={canUseTouchScreen}), so on a non-touch browser the key never renders (confirmed while attempting to verify on web).
What changes do you think we should make in order to solve the problem?
Stop dropping the sign signal when the amount is empty. In toggleNegative, report the value based on nextIsNegative rather than on currentNumber being truthy, so an empty negative flip reports '-' (marking the screen dirty via typedAmount !== '') and a flip back to positive reports '' (clean again).
This is safe: typedAmount is only consumed by getAmountHasUnsavedChanges for dirtiness — the actual submit path composes the amount from the form's own getNumber()/isNegative, not typedAmount. One edge to handle: in the non-create (edit) branch of getAmountHasUnsavedChanges, Number.parseFloat('-') is NaN, so a bare '-' should be normalized to amount 0 there to avoid a false-dirty when editing an existing 0 amount.
Evidence & data flow
User taps +/- with no digit → NumberWithSymbolFormcurrentNumber is '' (getNumber() returns '').
toggleNegative flips the sign but calls onAmountChange('') (sign dropped).
Discard hook beforeRemove sees hasUnsavedChanges() === false and returns early → no modal.
Confidence: High — every step is confirmed by static code reading. Web runtime verification wasn't possible because the +/- key only renders on touch platforms, which is consistent with the issue reproducing on iOS/Android App only.
What alternative solutions did you explore? (Optional)
Alternatively, mirror the form's isNegative state into IOURequestStepAmount's dirtiness computation instead of encoding it in the reported string. The form-level fix is smaller and keeps the sign logic co-located.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99042) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
When creating a manual expense on mobile/touch platforms (iOS and Android), tapping only the +/- (sign toggle) key without entering any digits and then swiping/navigating back fails to display the discard confirmation modal.
What is the root cause of that problem?
The discard confirmation hook (IOURequestStepAmount.tsx:139-151) calculates unsaved changes using typedAmount state via getAmountHasUnsavedChanges:
When no digits are entered, currentNumber is ''. Because currentNumber is falsy, it calls onAmountChange?.('') instead of onAmountChange?.('-'), silently dropping the minus sign.
If a user enters -5 and backspaces the 5, newAmount becomes ''. The wrapper evaluates newAmount && isNegative to '', reverting typedAmount to clean even though the - sign is still active on screen.
When the user backspaces the bare - sign (triggering clearNegative), it resets isNegative to false but does not notify onAmountChange, leaving typedAmount out of sync.
Because typedAmount remains '', getAmountHasUnsavedChanges returns false ('' !== ''), and useDiscardChangesConfirmation does not prompt the user.
What changes do you think we should make in order to solve the problem?
1. In src/pages/iou/MoneyRequestAmountForm.tsx:
In toggleNegative: report nextIsNegative ? \-${currentNumber}` : currentNumberso toggling to negative sends'-'and toggling back sends''`.
In clearNegative: call onAmountChange?.(currentNumber) so backspacing the minus sign resets typedAmount back to ''.
In useImperativeHandle: update getNumber() to isNegative ? \-${number}` : numberto guaranteegetNumber()andtypedAmount` remain 100% in sync at all times.
In MoneyRequestAmountInputonAmountChange: report isNegative ? \-${newAmount}` : newAmount`.
What alternative solutions did you explore? (Optional)
Alternative: Exposing isNegative on amountFormRef and adding signChanged parameter to getAmountHasUnsavedChanges
We explored exposing isNegative via the imperative ref amountFormRef and passing signChanged to getAmountHasUnsavedChanges. However, this approach has notable drawbacks:
Missing re-renders: If toggleNegative does not emit a change via onAmountChange, IOURequestStepAmount will not re-render when +/- is pressed, creating synchronization gaps.
Unnecessary API expansion: Adding signChanged across AmountHasUnsavedChangesParams, MoneyRequestAmountFormHandle, and IOURequestStepAmount adds code overhead compared to treating the signed string ('-') as the single source of truth.
📣 @Usama123talib! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
changed the title [-]Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/-][+][$175] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/+]on Nov 13, 2026
changed the title [-][$175] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/-][+][$250] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/+]on Nov 13, 2026
📣 @TaduJR 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻
Keep in mind: Code of Conduct | Contributing 📖
Activity
applause-bot commentedon Aug 20, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/89606af7977dd6a304c25fe82e73b05e2d1ad6a3da1c7d8e90762a8b72296c90
MelvinBot commentedon Aug 20, 2026
Proposal
What is the root cause of that problem?
Tapping only the +/- key on the manual amount screen flips the visible sign but reports an empty change signal, so the screen never registers as "dirty" and the discard guard is never armed.
When the sign is toggled,
toggleNegativereports the newly-signed value to the amount step. But it gates the sign on the number being non-empty:MoneyRequestAmountForm.tsx:163—onAmountChange?.(currentNumber && nextIsNegative ?-${currentNumber}: currentNumber)With no digit typed,
currentNumberis'', socurrentNumber && nextIsNegativeis falsy and the reported value is''— the sign is dropped. That''is mirrored intotypedAmountatIOURequestStepAmount.tsx:318, and the create-entry dirtiness check reads it as clean:MoneyRequestUtils.ts:210-211—return typedAmount !== '' || committedAmount !== 0 || currencyChanged;→'' !== '' (false) || 0 !== 0 (false) || false→ not dirty.getHasUnsavedChanges()returns false, so the discard guard'sbeforeRemovereturns early and navigation proceeds with no modal.This regressed in PR #97020, which reworked the discard guard to arm only when the screen has unsaved changes. Its own test step 9 is exactly this scenario. The bug is App-only (iOS/Android) — not desktop web — because the +/- key is part of the touch-only
BigNumberPad(shouldShowBigNumberPad={canUseTouchScreen}), so on a non-touch browser the key never renders (confirmed while attempting to verify on web).What changes do you think we should make in order to solve the problem?
Stop dropping the sign signal when the amount is empty. In
toggleNegative, report the value based onnextIsNegativerather than oncurrentNumberbeing truthy, so an empty negative flip reports'-'(marking the screen dirty viatypedAmount !== '') and a flip back to positive reports''(clean again).This is safe:
typedAmountis only consumed bygetAmountHasUnsavedChangesfor dirtiness — the actual submit path composes the amount from the form's owngetNumber()/isNegative, nottypedAmount. One edge to handle: in the non-create (edit) branch ofgetAmountHasUnsavedChanges,Number.parseFloat('-')isNaN, so a bare'-'should be normalized to amount0there to avoid a false-dirty when editing an existing 0 amount.Evidence & data flow
NumberWithSymbolFormcurrentNumberis''(getNumber()returns'').toggleNegativeflips the sign but callsonAmountChange('')(sign dropped).setTypedAmount('')→typedAmount = ''.getHasUnsavedChanges→getAmountHasUnsavedChanges({typedAmount:'', committedAmount:0, isCreateEntry:true, currency unchanged}).MoneyRequestUtils.ts:210-211returns false → clean.beforeRemoveseeshasUnsavedChanges() === falseand returns early → no modal.Confidence: High — every step is confirmed by static code reading. Web runtime verification wasn't possible because the +/- key only renders on touch platforms, which is consistent with the issue reproducing on iOS/Android App only.
What alternative solutions did you explore? (Optional)
Alternatively, mirror the form's
isNegativestate intoIOURequestStepAmount's dirtiness computation instead of encoding it in the reported string. The form-level fix is smaller and keeps the sign logic co-located.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99042)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Aug 20, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @marufsharifi (
External)j3ffffff commentedon Aug 20, 2026
melvin-bot commentedon Aug 20, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022090359280174593037
marufsharifi commentedon Aug 20, 2026
reproduced, checking the proposal.
Usama123talib commentedon Aug 20, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a manual expense on mobile/touch platforms (iOS and Android), tapping only the
+/-(sign toggle) key without entering any digits and then swiping/navigating back fails to display the discard confirmation modal.What is the root cause of that problem?
The discard confirmation hook (IOURequestStepAmount.tsx:139-151) calculates unsaved changes using
typedAmountstate viagetAmountHasUnsavedChanges:In MoneyRequestAmountForm.tsx, the sign prefix is unnecessarily gated on
number/amountbeing non-empty in 3 places:toggleNegative(line 158-164):When no digits are entered,
currentNumberis''. BecausecurrentNumberis falsy, it callsonAmountChange?.('')instead ofonAmountChange?.('-'), silently dropping the minus sign.MoneyRequestAmountInput'sonAmountChangewrapper (line 306-313):If a user enters
-5and backspaces the5,newAmountbecomes''. The wrapper evaluatesnewAmount && isNegativeto'', revertingtypedAmountto clean even though the-sign is still active on screen.clearNegative(line 166-168):When the user backspaces the bare
-sign (triggeringclearNegative), it resetsisNegativetofalsebut does not notifyonAmountChange, leavingtypedAmountout of sync.Because
typedAmountremains'',getAmountHasUnsavedChangesreturnsfalse('' !== ''), anduseDiscardChangesConfirmationdoes not prompt the user.What changes do you think we should make in order to solve the problem?
1. In
src/pages/iou/MoneyRequestAmountForm.tsx:toggleNegative: reportnextIsNegative ? \-${currentNumber}` : currentNumberso toggling to negative sends'-'and toggling back sends''`.clearNegative: callonAmountChange?.(currentNumber)so backspacing the minus sign resetstypedAmountback to''.useImperativeHandle: updategetNumber()toisNegative ? \-${number}` : numberto guaranteegetNumber()andtypedAmount` remain 100% in sync at all times.MoneyRequestAmountInputonAmountChange: reportisNegative ? \-${newAmount}` : newAmount`.And in JSX:
2. In
src/libs/MoneyRequestUtils.ts:Safely handle
'-'in the edit branch ofgetAmountHasUnsavedChangesto preventNaNwhenNumber.parseFloat('-')is executed:What specific scenarios should we cover in automated tests to prevent regression?
Add unit tests in
tests/unit/MoneyRequestUtilsTest.tsforgetAmountHasUnsavedChanges:'-'):getAmountHasUnsavedChanges({typedAmount: '-', committedAmount: 0, isCreateEntry: true, selectedCurrency: 'USD', originalCurrency: 'USD'})returnstrue.''):getAmountHasUnsavedChanges({typedAmount: '', committedAmount: 0, isCreateEntry: true, selectedCurrency: 'USD', originalCurrency: 'USD'})returnsfalse.'-') and0committed amount:getAmountHasUnsavedChanges({typedAmount: '-', committedAmount: 0, isCreateEntry: false, selectedCurrency: 'USD', originalCurrency: 'USD'})returnsfalse(handlesNaNgracefully without a false-positive dirty flag).'-5'vs500):getAmountHasUnsavedChanges({typedAmount: '-5', committedAmount: 500, isCreateEntry: false, selectedCurrency: 'USD', originalCurrency: 'USD'})returnstrue.'-5'vs-500):getAmountHasUnsavedChanges({typedAmount: '-5', committedAmount: -500, isCreateEntry: false, selectedCurrency: 'USD', originalCurrency: 'USD'})returnsfalse.What alternative solutions did you explore? (Optional)
Alternative: Exposing
isNegativeonamountFormRefand addingsignChangedparameter togetAmountHasUnsavedChangesWe explored exposing
isNegativevia the imperative refamountFormRefand passingsignChangedtogetAmountHasUnsavedChanges. However, this approach has notable drawbacks:typedAmount) to eliminate timing windows and stale discard states during swipe transitions.toggleNegativedoes not emit a change viaonAmountChange,IOURequestStepAmountwill not re-render when+/-is pressed, creating synchronization gaps.signChangedacrossAmountHasUnsavedChangesParams,MoneyRequestAmountFormHandle, andIOURequestStepAmountadds code overhead compared to treating the signed string ('-') as the single source of truth.cc @marufsharifi
melvin-bot commentedon Aug 20, 2026
📣 @Usama123talib! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
Usama123talib commentedon Aug 20, 2026
Contributor details
Your Expensify account email: talibusama1234@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0169f347c5f3562928
melvin-bot commentedon Aug 20, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
marufsharifi commentedon Aug 22, 2026
🆘 C+ Help Wanted
53 remaining items
[-]Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/-][+][$175] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/+]melvin-bot commentedon Nov 13, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 (
External)[-][$175] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/-][+][$250] Discard modal doesn’t appear after swipe if only +/- was entered in manual expense[/+]mallenexpensify commentedon Nov 13, 2026
Claude posting on behalf of Matt:
@TaduJR please take over as the Contributor. Use PR #100394 as a reference and open your own PR: #100394
@ikevin127 please take over as C+.
Please use MelvinBot where it can help.
melvin-bot commentedon Nov 13, 2026
Upwork job price has been updated to $250
melvin-bot commentedon Nov 13, 2026
📣 @TaduJR 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻
Keep in mind: Code of Conduct | Contributing 📖
TaduJR commentedon Nov 19, 2026
Not Overdue.
Working on PR.