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
Per Diem - Subrate field becomes empty after selecting a report from another workspace #82877
Version Number: 9.3.22-1 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#81942 Email or phone of affected tester (no customers):applausetester+bm1057@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Web, android App Component: Money Requests
Action Performed:
Precondition:
Create two workspaces - A and B.
Import per diem rates to both workspaces (can use the same per diem rates).
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
When creating a per diem expense via the global FAB (Create expense > Per diem), selecting a workspace, filling in all per diem data (destination, subrate, quantity), and then changing the report on the confirmation page to one from a different workspace, the subrate field becomes empty. All other information is preserved but the subrate is lost.
What is the root cause of that problem?
There are two contributing issues:
1. Validation bypass during CREATE flow (src/pages/iou/request/step/IOURequestEditReportCommon.tsx:71,159-184)
The checkIfPerDiemTransactionsCanBeMoved function is supposed to block cross-workspace report selection for per diem transactions. However, it reads transactions from ONYXKEYS.COLLECTION.TRANSACTION (real/committed transactions). During the CREATE flow, the per diem transaction only exists in ONYXKEYS.COLLECTION.TRANSACTION_DRAFT. So the lookup returns undefined, isPerDiem evaluates to false, and the validation incorrectly allows the cross-workspace report selection to proceed.
2. Intentional subrate clearing on policy change (src/pages/iou/request/step/IOURequestStepReport.tsx:133-138)
Once the validation is bypassed, handleGlobalCreateReport detects that the policy changed and intentionally clears the per diem data:
setCustomUnitID -- updates to new workspace's per diem unit
setCustomUnitRateID(transactionID, undefined, ...) -- clears the destination
clearSubrates(transactionID) -- empties the subRates array to []
This clearing is correct behavior when a genuine workspace change occurs (since subrates are workspace-specific), but it should never be reached because the validation should block cross-workspace moves.
What changes do you think we should make in order to solve the problem?
Fix checkIfPerDiemTransactionsCanBeMoved in src/pages/iou/request/step/IOURequestEditReportCommon.tsx to also check ONYXKEYS.COLLECTION.TRANSACTION_DRAFT when looking up the transaction. If the transaction is not found in real transactions, fall back to the draft transaction collection. This way, during the CREATE flow, the validation will correctly identify the per diem transaction, detect the incompatible customUnitID, and show the warning modal to block the cross-workspace selection.
The change would look something like: read from both ONYXKEYS.COLLECTION.TRANSACTION and ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, and use whichever has the transaction. This ensures the per diem guard works for both existing and draft transactions.
What alternative solutions did you explore? (Optional)
Redirect to destination step instead of confirmation -- After clearing subrates on workspace change, redirect the user to re-select a destination and subrates for the new workspace. This would allow the cross-workspace change to proceed but require the user to re-enter per diem data. However, this is more complex and the simpler fix is to just block the invalid move as originally intended.
Filter out incompatible reports in the list -- Instead of showing all workspace reports and then blocking selection, filter out reports from workspaces where the per diem transaction can't be moved. This is a UX improvement but the validation fix is more important as the primary fix.
Detailed Investigation
Root Cause Analysis
PR #81942 changed IOURequestStepReport.tsx:265 so that selectedPolicyID is undefined for per diem transactions from global create (previously it used perDiemOriginalPolicy?.id). This causes useOutstandingReports to return reports from all workspaces.
The validation gate validatePerDiemMove in IOURequestEditReportCommon.tsx:189-204 calls checkIfPerDiemTransactionsCanBeMoved, which should block cross-workspace moves. But at line 162, it looks up the transaction:
allTransactions (line 71) reads from ONYXKEYS.COLLECTION.TRANSACTION only. During CREATE, the transaction is a draft. So transaction is undefined, isPerDiem is false, the find callback returns false, and validation incorrectly passes.
Once past validation, handleGlobalCreateReport (line 99-147) runs. It compares perDiemOriginalPolicy?.id with the new report's policyID. When different, it calls:
clearSubrates (IOU/index.ts:1671) sets subRates: [] on the draft via Onyx.merge. setCustomUnitRateID with undefined clears the destination.
Back on the confirmation page, IOURequestStepSubrate.tsx:88-90 reads customUnitRateID (now undefined) as selectedDestination, making allPossibleSubrates empty. The transaction's subRates is also []. The subrate field shows empty.
Please re-state the problem that we are trying to solve in this issue.
When a user creates a per diem expense with destination and subrates filled in, then changes the report to one from a different workspace on the confirmation page, the subrate field becomes empty even when both workspaces have identical per diem rate configurations.
What is the root cause of that problem?
The code in IOURequestStepReport.tsx unconditionally clears the customUnitRateID (destination) and subRates whenever the policy changes for a per diem transaction, without checking if the destination rate exists in the new policy:
This logic was designed to handle incompatible rate structures, but it discards user-entered data even when both workspaces share identical per diem rates imported from the same source.
What changes do you think we should make in order to solve the problem?
Add validation before clearing subrates to check if the destination rate exists in the new policy. If it exists, preserve the customUnitRateID and subRates. Only clear if the rate structure is genuinely incompatible.
Import the getPerDiemRateCustomUnitRate helper in IOURequestStepReport.tsx:
// Clear subrates, and update customUnitID if policy changed for per diem transactionsif(policyChanged&&isPerDiemTransaction){constcurrentRateID=transaction?.comment?.customUnit?.customUnitRateID;constdestinationExistsInNewPolicy=currentRateID&&!!getPerDiemRateCustomUnitRate(newPolicy,currentRateID);if(destinationExistsInNewPolicy){// Preserve the destination and subrates - only update the customUnitIDsetCustomUnitID(transaction.transactionID,newCustomUnitID??CONST.CUSTOM_UNITS.FAKE_P2P_ID,);}else{// Destination doesn't exist in new policy - fall back to current behaviorsetCustomUnitID(transaction.transactionID,newCustomUnitID??CONST.CUSTOM_UNITS.FAKE_P2P_ID,);setCustomUnitRateID(transaction.transactionID,undefined,transaction,newPolicy,);clearSubrates(transaction.transactionID);}}
This pattern matches the existing "State Validation Before Reset" approach used elsewhere in the codebase (e.g., IOURequestStepConfirmation.tsx:396-398):
What alternative solutions did you explore? (Optional)
Always preserve subrates on policy change - rejected because this could leave invalid subrate data if the rate structures differ significantly between workspaces.
Compare subrate field names/structure between policies - rejected as overly complex when the simpler rate existence check is sufficient to determine compatibility.
Files Modified:
src/pages/iou/request/step/IOURequestStepReport.tsx - Added validation to preserve subrates when destination exists in new policy
Activity
melvin-bot commentedon Feb 19, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #81942
melvin-bot commentedon Feb 19, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 19, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Pujan92 (
External)melvin-bot commentedon Feb 19, 2026
Triggered auto assignment to @CortneyOfstad (
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.melvin-bot commentedon Feb 19, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
github-actions commentedon Feb 19, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
MelvinBot commentedon Feb 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When creating a per diem expense via the global FAB (Create expense > Per diem), selecting a workspace, filling in all per diem data (destination, subrate, quantity), and then changing the report on the confirmation page to one from a different workspace, the subrate field becomes empty. All other information is preserved but the subrate is lost.
What is the root cause of that problem?
There are two contributing issues:
1. Validation bypass during CREATE flow (
src/pages/iou/request/step/IOURequestEditReportCommon.tsx:71,159-184)The
checkIfPerDiemTransactionsCanBeMovedfunction is supposed to block cross-workspace report selection for per diem transactions. However, it reads transactions fromONYXKEYS.COLLECTION.TRANSACTION(real/committed transactions). During the CREATE flow, the per diem transaction only exists inONYXKEYS.COLLECTION.TRANSACTION_DRAFT. So the lookup returnsundefined,isPerDiemevaluates tofalse, and the validation incorrectly allows the cross-workspace report selection to proceed.2. Intentional subrate clearing on policy change (
src/pages/iou/request/step/IOURequestStepReport.tsx:133-138)Once the validation is bypassed,
handleGlobalCreateReportdetects that the policy changed and intentionally clears the per diem data:setCustomUnitID-- updates to new workspace's per diem unitsetCustomUnitRateID(transactionID, undefined, ...)-- clears the destinationclearSubrates(transactionID)-- empties the subRates array to[]This clearing is correct behavior when a genuine workspace change occurs (since subrates are workspace-specific), but it should never be reached because the validation should block cross-workspace moves.
What changes do you think we should make in order to solve the problem?
Fix
checkIfPerDiemTransactionsCanBeMovedinsrc/pages/iou/request/step/IOURequestEditReportCommon.tsxto also checkONYXKEYS.COLLECTION.TRANSACTION_DRAFTwhen looking up the transaction. If the transaction is not found in real transactions, fall back to the draft transaction collection. This way, during the CREATE flow, the validation will correctly identify the per diem transaction, detect the incompatiblecustomUnitID, and show the warning modal to block the cross-workspace selection.The change would look something like: read from both
ONYXKEYS.COLLECTION.TRANSACTIONandONYXKEYS.COLLECTION.TRANSACTION_DRAFT, and use whichever has the transaction. This ensures the per diem guard works for both existing and draft transactions.What alternative solutions did you explore? (Optional)
Redirect to destination step instead of confirmation -- After clearing subrates on workspace change, redirect the user to re-select a destination and subrates for the new workspace. This would allow the cross-workspace change to proceed but require the user to re-enter per diem data. However, this is more complex and the simpler fix is to just block the invalid move as originally intended.
Filter out incompatible reports in the list -- Instead of showing all workspace reports and then blocking selection, filter out reports from workspaces where the per diem transaction can't be moved. This is a UX improvement but the validation fix is more important as the primary fix.
Detailed Investigation
Root Cause Analysis
PR #81942 changed
IOURequestStepReport.tsx:265so thatselectedPolicyIDisundefinedfor per diem transactions from global create (previously it usedperDiemOriginalPolicy?.id). This causesuseOutstandingReportsto return reports from all workspaces.The validation gate
validatePerDiemMoveinIOURequestEditReportCommon.tsx:189-204callscheckIfPerDiemTransactionsCanBeMoved, which should block cross-workspace moves. But at line 162, it looks up the transaction:allTransactions(line 71) reads fromONYXKEYS.COLLECTION.TRANSACTIONonly. During CREATE, the transaction is a draft. Sotransactionisundefined,isPerDiemisfalse, thefindcallback returnsfalse, and validation incorrectly passes.Once past validation,
handleGlobalCreateReport(line 99-147) runs. It comparesperDiemOriginalPolicy?.idwith the new report'spolicyID. When different, it calls:setCustomUnitID(line 135)setCustomUnitRateID(transactionID, undefined, ...)(line 136)clearSubrates(transactionID)(line 137)clearSubrates(IOU/index.ts:1671) setssubRates: []on the draft viaOnyx.merge.setCustomUnitRateIDwithundefinedclears the destination.Back on the confirmation page,
IOURequestStepSubrate.tsx:88-90readscustomUnitRateID(nowundefined) asselectedDestination, makingallPossibleSubratesempty. The transaction'ssubRatesis also[]. The subrate field shows empty.Evidence Chain
selectedPolicyID = undefined(line 265) ->useOutstandingReportsreturns all-workspace reportshandleSelectReportcallsvalidatePerDiemMovecheckIfPerDiemTransactionsCanBeMovedlooks upONYXKEYS.COLLECTION.TRANSACTION-> transaction not found (it's a draft) -> validation passes incorrectlyselectReportcalled ->handleGlobalCreateReport->policyChanged = true->clearSubrates()+setCustomUnitRateID(undefined)Relevant Code
src/pages/iou/request/step/IOURequestStepReport.tsx:265- selectedPolicyID set to undefinedsrc/pages/iou/request/step/IOURequestStepReport.tsx:99-138- handleGlobalCreateReport clearing logicsrc/pages/iou/request/step/IOURequestEditReportCommon.tsx:71- allTransactions reads only real transactionssrc/pages/iou/request/step/IOURequestEditReportCommon.tsx:159-184- checkIfPerDiemTransactionsCanBeMoved validationsrc/libs/actions/IOU/index.ts:1671-1673- clearSubrates implementationsrc/pages/iou/request/step/IOURequestStepSubrate.tsx:88-90- subrate display logicNext Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.HiepPP commentedon Feb 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user creates a per diem expense with destination and subrates filled in, then changes the report to one from a different workspace on the confirmation page, the subrate field becomes empty even when both workspaces have identical per diem rate configurations.
What is the root cause of that problem?
The code in
IOURequestStepReport.tsxunconditionally clears thecustomUnitRateID(destination) andsubRateswhenever the policy changes for a per diem transaction, without checking if the destination rate exists in the new policy:App/src/pages/iou/request/step/IOURequestStepReport.tsx
Lines 133 to 138 in 1e8ce82
This logic was designed to handle incompatible rate structures, but it discards user-entered data even when both workspaces share identical per diem rates imported from the same source.
What changes do you think we should make in order to solve the problem?
Add validation before clearing subrates to check if the destination rate exists in the new policy. If it exists, preserve the
customUnitRateIDandsubRates. Only clear if the rate structure is genuinely incompatible.getPerDiemRateCustomUnitRatehelper inIOURequestStepReport.tsx:src/pages/iou/request/step/IOURequestStepReport.tsxsrc/pages/iou/request/step/IOURequestStepReport.tsxThis pattern matches the existing "State Validation Before Reset" approach used elsewhere in the codebase (e.g.,
IOURequestStepConfirmation.tsx:396-398):App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 396 to 398 in 1e8ce82
What alternative solutions did you explore? (Optional)
Always preserve subrates on policy change - rejected because this could leave invalid subrate data if the rate structures differ significantly between workspaces.
Compare subrate field names/structure between policies - rejected as overly complex when the simpler rate existence check is sufficient to determine compatibility.
Files Modified:
src/pages/iou/request/step/IOURequestStepReport.tsx- Added validation to preserve subrates when destination exists in new policyizarutskaya commentedon Feb 19, 2026
QA team can't reproduce the issue as workspace B is not displayed in report field list
Build 9.3.22-2
Windows 11 / Chrome
per.diem.ws.b.mp4
Recording.3645.mp4
MarioExpensify commentedon Feb 19, 2026
Thank you @izarutskaya. Closing this one - will be fixed in the original issue.