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
[Due for payment 2026-04-02] [$250] Track distance - Amount and Rate are not greyed out after editing in offline mode #84252
Version Number: v9.3.31-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#83393 Email or phone of affected tester (no customers):applausetester+ag040326@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Windows 11/ Chrome, iPhone 13 Mini/ iOS 26.3 App Component: Money Requests
Action Performed:
Preconditions: Workspace has distance rates enabled.
Have at least two distance rates.
In a workspace, have a distance expense with the distance rate A selected.
Open the Expensify app
Go to workspace settings > Distance rates
Edit the rate of the distance rate A
Go to the expense details with the distance rate A
Go offline
Change the Rate to any other
Note that the Amount and Rate have been updated but not greyed out
Change the Rate back to the distance rate A
Note that the Amount and Rate have been updated again, but they are still not greyed out, and the violation remains
Go online
Expected Result:
In step 7, the Amount and the Rate are greyed out.
In step 9, the Amount and the Rate are still greyed out, and the violation clears.
Actual Result:
In step 7, the Amount and Rate have been updated, but they are not greyed out despite being edited.
In step 9, the Amount and the Rate are still not greyed out, and the violation remains despite no longer having any difference between the amount and the calculated distance.
The violation is cleared after going online.
Please re-state the problem that we are trying to solve in this issue.
When editing the distance rate on a distance expense while offline, the Amount and Rate fields are not greyed out (pending indicator missing). Additionally, if the rate is changed back to the original, the modifiedAmount violation is not cleared until the device goes back online.
What is the root cause of that problem?
There are two separate root causes:
1. Missing pendingFields for customUnitRateID changes
When a user changes the distance rate, updateMoneyRequestDistanceRate() creates transactionChanges = {customUnitRateID: rateID} (IOU/index.ts:5898-5902). This calls getUpdatedTransaction(), which correctly recalculates amount, modifiedAmount, modifiedMerchant, and modifiedCurrency based on the new rate (TransactionUtils/index.ts:754-801).
However, the pendingFields computation at TransactionUtils/index.ts:906-928 only sets pending flags for keys explicitly present in transactionChanges. There is no case for customUnitRateID, so pendingFields ends up with no new entries. Compare this with the distance key at lines 921-925, which correctly maps to {amount, merchant, quantity} pending fields — the same pattern is missing for customUnitRateID.
Because the transaction's pendingFields never includes customUnitRateID, amount, merchant, or currency, the getPendingFieldAction() calls in MoneyRequestView.tsx return undefined, and OfflineWithFeedback does not apply the greyed-out opacity.
The same issue exists in getClearedPendingFields() at TransactionUtils/index.ts:637-659, which also lacks a customUnitRateID case for clearing the derived pending fields on success/failure.
2. modifiedAmount (distance) violation not cleared optimistically
The modifiedAmount violation with type: 'distance' ("Amount differs from calculated distance") is only generated and cleared by the server. It is completely absent from the client-side ViolationsUtils.getViolationsOnyxData() function (ViolationsUtils.ts:399-412).
In getUpdateMoneyRequestParams() at IOU/index.ts:4916-4942, the current violations are fetched and passed to getViolationsOnyxData(). The filtering at lines 4918-4921 only removes DUPLICATED_TRANSACTION when amount/date/currency change — there is no filter for modifiedAmount when hasModifiedDistanceRate is true. So the stale modifiedAmount violation persists in the optimistic data until the server responds.
What changes do you think we should make in order to solve the problem?
Fix 1 — Add customUnitRateID to pendingFields and getClearedPendingFields:
In getUpdatedTransaction() at src/libs/TransactionUtils/index.ts:906-928, add a case for customUnitRateID that also marks amount, merchant, and currency as pending (since those values are recalculated when the rate changes):
Fix 2 — Clear stale modifiedAmount (distance) violation optimistically:
In getUpdateMoneyRequestParams() at src/libs/actions/IOU/index.ts, after the existing violation filtering (around line 4921), add a filter to remove the modifiedAmount violation with distance type when the distance rate is being changed (since the amount is being recalculated to match the new rate):
What alternative solutions did you explore? (Optional)
For the pending fields issue, an alternative would be to modify updateMoneyRequestDistanceRate() to explicitly include amount, merchant, and currency in transactionChanges. However, this is less maintainable because it couples the action to internal knowledge of derived field updates, and the pattern of mapping derived fields in getUpdatedTransaction() already exists for the distance key.
For the violation issue, an alternative would be to add modifiedAmount handling to ViolationsUtils.getViolationsOnyxData() (checking if the recalculated distance amount matches the transaction amount). This would be more robust but more complex, and filtering the stale violation during rate changes is sufficient since the server will reconcile the final state.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
changed the title [-]Track distance - Amount and Rate are not greyed out after editing in offline mode[/-][+][$250] Track distance - Amount and Rate are not greyed out after editing in offline mode[/+]on Mar 5, 2026
Please re-state the problem that we are trying to solve in this issue.
When editing the distance rate on a distance expense while offline, the Amount and Rate fields are not greyed out to indicate pending status. Additionally, when the rate is changed back to the original value, the modifiedAmount violation persists until the device goes back online.
What is the root cause of that problem?
The getUpdateMoneyRequestParams() function in IOU/index.ts calculates pendingFields from the transactionChanges on line 4538, but fails to include them in the optimistic transaction update at lines 4742-4750.
The UI components in MoneyRequestView call getPendingFieldAction() to check transaction.pendingFields for each field (line 415, 823 for Amount, line 644 for Rate). The OfflineWithFeedback component then uses this pending action to determine whether to apply the greyed-out opacity effect. Without pendingFields in the transaction, getPendingFieldAction() returns undefined, so the opacity is never applied.
In contrast, the similar getUpdateTrackExpenseParams() function in the same file correctly includes pendingFields in its optimistic transaction update at line 5190, which is why track expenses work correctly but workspace expenses do not.
What changes do you think we should make in order to solve the problem?
In IOU/index.ts, add pendingFields to the optimistic transaction update in getUpdateMoneyRequestParams():
This matches the pattern already used in getUpdateTrackExpenseParams() and ensures the UI can properly detect pending fields to apply the greyed-out state.
What alternative solutions did you explore? (Optional)
The existing MelvinBot proposal suggests modifying TransactionUtils to add customUnitRateID handling to pendingFields computation and clearing modifiedAmount violations optimistically. While that approach would work, it's more complex and modifies multiple functions. This solution is simpler and more targeted — the pendingFields are already being calculated correctly on line 4538; they just need to be included in the optimistic data. This single-line fix directly addresses the root cause without changing the violation handling logic or requiring modifications to multiple utility functions.
In getUpdateMoneyRequestParams, pending fields are computed but not merged into the optimistic transaction update for this path, so edited fields can update without entering pending/greyed state.
For violations, optimistic filtering removes some stale violations (like noRoute) but does not remove stale distance modifiedAmount violations before recalculation, so the mismatch violation can persist locally until reconnect/server sync.
What changes do you think we should make in order to solve the problem?
Persist pendingFields on the optimistic transaction merge in getUpdateMoneyRequestParams, so Amount and Rate reflect the pending offline state immediately.
Before recomputing violations, remove stale distance modifiedAmount violation entries when distance-related edits occur (customUnitRateID, distance, or pending waypoints flow), so switching back to the original valid rate clears the violation immediately offline.
⚠️@abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Activity
melvin-bot commentedon Mar 5, 2026
Triggered auto assignment to @kadiealexander (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.MelvinBot commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing the distance rate on a distance expense while offline, the Amount and Rate fields are not greyed out (pending indicator missing). Additionally, if the rate is changed back to the original, the
modifiedAmountviolation is not cleared until the device goes back online.What is the root cause of that problem?
There are two separate root causes:
1. Missing
pendingFieldsforcustomUnitRateIDchangesWhen a user changes the distance rate,
updateMoneyRequestDistanceRate()createstransactionChanges = {customUnitRateID: rateID}(IOU/index.ts:5898-5902). This callsgetUpdatedTransaction(), which correctly recalculatesamount,modifiedAmount,modifiedMerchant, andmodifiedCurrencybased on the new rate (TransactionUtils/index.ts:754-801).However, the
pendingFieldscomputation atTransactionUtils/index.ts:906-928only sets pending flags for keys explicitly present intransactionChanges. There is no case forcustomUnitRateID, sopendingFieldsends up with no new entries. Compare this with thedistancekey at lines 921-925, which correctly maps to{amount, merchant, quantity}pending fields — the same pattern is missing forcustomUnitRateID.Because the transaction's
pendingFieldsnever includescustomUnitRateID,amount,merchant, orcurrency, thegetPendingFieldAction()calls inMoneyRequestView.tsxreturnundefined, andOfflineWithFeedbackdoes not apply the greyed-out opacity.The same issue exists in
getClearedPendingFields()atTransactionUtils/index.ts:637-659, which also lacks acustomUnitRateIDcase for clearing the derived pending fields on success/failure.2.
modifiedAmount(distance) violation not cleared optimisticallyThe
modifiedAmountviolation withtype: 'distance'("Amount differs from calculated distance") is only generated and cleared by the server. It is completely absent from the client-sideViolationsUtils.getViolationsOnyxData()function (ViolationsUtils.ts:399-412).In
getUpdateMoneyRequestParams()atIOU/index.ts:4916-4942, the current violations are fetched and passed togetViolationsOnyxData(). The filtering at lines 4918-4921 only removesDUPLICATED_TRANSACTIONwhen amount/date/currency change — there is no filter formodifiedAmountwhenhasModifiedDistanceRateis true. So the stalemodifiedAmountviolation persists in the optimistic data until the server responds.What changes do you think we should make in order to solve the problem?
Fix 1 — Add
customUnitRateIDtopendingFieldsandgetClearedPendingFields:In
getUpdatedTransaction()atsrc/libs/TransactionUtils/index.ts:906-928, add a case forcustomUnitRateIDthat also marksamount,merchant, andcurrencyas pending (since those values are recalculated when the rate changes):And the corresponding case in
getClearedPendingFields()atsrc/libs/TransactionUtils/index.ts:637-659:Fix 2 — Clear stale
modifiedAmount(distance) violation optimistically:In
getUpdateMoneyRequestParams()atsrc/libs/actions/IOU/index.ts, after the existing violation filtering (around line 4921), add a filter to remove themodifiedAmountviolation with distance type when the distance rate is being changed (since the amount is being recalculated to match the new rate):What alternative solutions did you explore? (Optional)
For the pending fields issue, an alternative would be to modify
updateMoneyRequestDistanceRate()to explicitly includeamount,merchant, andcurrencyintransactionChanges. However, this is less maintainable because it couples the action to internal knowledge of derived field updates, and the pattern of mapping derived fields ingetUpdatedTransaction()already exists for thedistancekey.For the violation issue, an alternative would be to add
modifiedAmounthandling toViolationsUtils.getViolationsOnyxData()(checking if the recalculated distance amount matches the transaction amount). This would be more robust but more complex, and filtering the stale violation during rate changes is sufficient since the server will reconcile the final state.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Mar 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)[-]Track distance - Amount and Rate are not greyed out after editing in offline mode[/-][+][$250] Track distance - Amount and Rate are not greyed out after editing in offline mode[/+]melvin-bot commentedon Mar 5, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022029468199571055503
twilight2294 commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing the distance rate on a distance expense while offline, the Amount and Rate fields are not greyed out to indicate pending status. Additionally, when the rate is changed back to the original value, the
modifiedAmountviolation persists until the device goes back online.What is the root cause of that problem?
The
getUpdateMoneyRequestParams()function in IOU/index.ts calculatespendingFieldsfrom thetransactionChangeson line 4538, but fails to include them in the optimistic transaction update at lines 4742-4750.The UI components in MoneyRequestView call
getPendingFieldAction()to checktransaction.pendingFieldsfor each field (line 415, 823 for Amount, line 644 for Rate). The OfflineWithFeedback component then uses this pending action to determine whether to apply the greyed-out opacity effect. WithoutpendingFieldsin the transaction,getPendingFieldAction()returns undefined, so the opacity is never applied.In contrast, the similar
getUpdateTrackExpenseParams()function in the same file correctly includespendingFieldsin its optimistic transaction update at line 5190, which is why track expenses work correctly but workspace expenses do not.What changes do you think we should make in order to solve the problem?
In IOU/index.ts, add
pendingFieldsto the optimistic transaction update ingetUpdateMoneyRequestParams():This matches the pattern already used in
getUpdateTrackExpenseParams()and ensures the UI can properly detect pending fields to apply the greyed-out state.What alternative solutions did you explore? (Optional)
The existing MelvinBot proposal suggests modifying
TransactionUtilsto addcustomUnitRateIDhandling topendingFieldscomputation and clearingmodifiedAmountviolations optimistically. While that approach would work, it's more complex and modifies multiple functions. This solution is simpler and more targeted — thependingFieldsare already being calculated correctly on line 4538; they just need to be included in the optimistic data. This single-line fix directly addresses the root cause without changing the violation handling logic or requiring modifications to multiple utility functions.abbasifaizan70 commentedon Mar 5, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing a distance expense offline after its selected workspace distance rate has changed:
Expected behavior is:
What is the root cause of that problem?
The UI pending state for Amount and Rate depends on transaction
pendingFields.App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 414 in 375ad05
App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 643 in 375ad05
App/src/components/ReportActionItem/MoneyRequestView.tsx
Line 821 in 375ad05
In
getUpdateMoneyRequestParams, pending fields are computed but not merged into the optimistic transaction update for this path, so edited fields can update without entering pending/greyed state.App/src/libs/actions/IOU/index.ts
Lines 4529 to 4531 in 375ad05
App/src/libs/actions/IOU/index.ts
Lines 4733 to 4741 in 375ad05
For violations, optimistic filtering removes some stale violations (like
noRoute) but does not remove stale distancemodifiedAmountviolations before recalculation, so the mismatch violation can persist locally until reconnect/server sync.App/src/libs/actions/IOU/index.ts
Lines 4918 to 4928 in 375ad05
App/src/libs/actions/IOU/index.ts
Lines 4930 to 4943 in 375ad05
What changes do you think we should make in order to solve the problem?
Persist
pendingFieldson the optimistic transaction merge ingetUpdateMoneyRequestParams, so Amount and Rate reflect the pending offline state immediately.App/src/libs/actions/IOU/index.ts
Lines 4733 to 4741 in 375ad05
Before recomputing violations, remove stale distance
modifiedAmountviolation entries when distance-related edits occur (customUnitRateID,distance, or pending waypoints flow), so switching back to the original valid rate clears the violation immediately offline.App/src/libs/actions/IOU/index.ts
Lines 4918 to 4928 in 375ad05
github-actions commentedon Mar 5, 2026
35 remaining items
melvin-bot commentedon Mar 26, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)thesahindia commentedon Mar 28, 2026
We need a test case, the steps are below:
melvin-bot commentedon Apr 2, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Apr 3, 2026
Payment Summary
Contributor: @abbasifaizan70 paid $250 via Upwork
Contributor+: @thesahindia due $250 via NewDot
^ Test case created
@abbasifaizan70 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022029468199571055503
abbasifaizan70 commentedon Apr 3, 2026
@mallenexpensify offer accepted & submitted for payment.
mallenexpensify commentedon Apr 3, 2026
@abbasifaizan70 paid, summary updated above. Thx.
garrettmknight commentedon Jul 28, 2026
$250 approved for @thesahindia