Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.3.54-0
Reproducible in staging?: Yes, but not reproducible with Use Staging Server Off
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-16749/folder/13176674/53829876/1313414640
Email or phone of affected tester (no customers): applausetester+abr2dg@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Web
App Component: Other
Action Performed:
- Create a per diem expense in the workspace chat
- Open the expense report
- Click Receipt and check the icon
Expected Result:
Per Diem expense receipt icon should displayed
Actual Result:
Per Diem expense receipt icon is not showing
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Video.mp4
Issue Owner
Current Issue Owner: @FitseTLTUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022041774297409889091
- Upwork Job ID: 2041774297409889091
- Last Price Increase: 2026-04-08
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon Apr 8, 2026
Proposal
What is the root cause of that problem?
The
isPerDiemRequest()function inTransactionUtils/index.ts:253-263usesObject.hasOwn(transaction, 'iouRequestType')to check whether to use the client-onlyiouRequestTypefield. This check returnstrueif the key exists on the object — even if its value isnullorundefined. After the transaction syncs with the server, if the server response includesiouRequestTypewith a falsy value (e.g.,null), the function short-circuits and returnsfalsewithout ever reaching the reliable fallback check (comment.type === 'customUnit' && comment.customUnit.name === 'Per Diem International').This causes
isPerDiemRequest()to returnfalsepost-sync, which meansEReceiptThumbnaildoesn't render the CalendarSolid icon, andReceiptImagedoesn't route the transaction through the per diem rendering path.The same
Object.hasOwnpattern exists inisDistanceRequest,isScanRequest,isTimeRequest, and other type-detection functions at lines 145, 161, 190, 200, 210, 226, 241, 267, 367 — all potentially affected by the same issue.A secondary contributing factor:
hasEReceiptis set optimistically (PerDiem.ts:419) but could also be overwritten by the server response, causing the transaction to lose its eReceipt status entirely.What changes do you think we should make in order to solve the problem?
In
isPerDiemRequest()(and the other request-type functions), change the guard from checking key existence to checking key value:This ensures that when
iouRequestTypeisnull/undefinedafter server sync, the function falls through to the server-side field check (comment.type+comment.customUnit.name) which is the authoritative source of truth for persisted transactions.Apply the same fix to all the other
Object.hasOwn(transaction, 'iouRequestType')call sites in TransactionUtils.What alternative solutions did you explore? (Optional)
An alternative would be to explicitly delete the
iouRequestTypekey from the transaction in thesuccessDatacallback, ensuring it doesn't persist after server sync. However, this is more fragile since Pusher updates could re-introduce the field. The proposed fix makes the detection logic robust regardless of what the server returns.Investigation details
Rendering chain for per diem receipt icon:
MoneyRequestReceiptView→ checkshasReceipt()(which includeshasEReceipt) → rendersReportActionItemImageReportActionItemImage:144→isEReceipt = !hasReceiptSource(transaction) && hasEReceipt(transaction)→ setspropsObj.isPerDiemRequestat line 180ReceiptImage:191-214→ routesisEReceipt && isPerDiemRequesttoEReceiptThumbnailEReceiptThumbnail:112-119→ renders CalendarSolid icon only when internalisPerDiemRequest()check returnstrueWhy staging-only: The staging server likely includes
iouRequestTypein its transaction response (possibly as part of a newer backend version), while production does not. When the staging response merges into Onyx with a falsyiouRequestTypevalue,Object.hasOwnreturnstruebut the value comparison fails.Affected call sites: Lines 145, 161, 190, 200, 210, 226, 241, 255, 267, 367 in
TransactionUtils/index.tsNext Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon Apr 8, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @FitseTLT (
External)[-]Per Diem expense receipt icon not displayed[/-][+][$250] Per Diem expense receipt icon not displayed[/+]melvin-bot commentedon Apr 8, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022041774297409889091
Abdullahtmk commentedon Apr 8, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user creates a per diem expense in the workspace chat and then opens the expense report to check the receipt, the per diem expense receipt icon is not displayed, even though it should show a receipt indicator.
What is the root cause of that problem?
The receipt icon display logic likely checks for a transaction's receipt or receipt state, but per diem expenses may not have a receipt object or may have a different receipt state indicator than regular expenses. The receipt icon rendering component skips displaying the icon when it cannot find the expected receipt data structure for per diem transactions.
What changes do you think we should make in order to solve the problem?
Locate the receipt icon display component (likely in
src/components/AttachmentPreview.tsxor receipt-related files) and update the logic to handle per diem expenses:Alternatively, if the per diem receipt icon is handled separately, ensure the per diem expense creation flow (likely in
src/libs/actions/IOU.ts) sets the appropriate receipt indicator flag that the display logic checks for.What alternative solutions did you explore? (Optional)
Why this works: Routes the per diem receipt display through the same icon rendering logic as regular expenses, ensuring visual consistency.
yuvrajangadsingh commentedon Apr 8, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-04-11 14:24:57 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
After creating a per diem expense on staging, the receipt calendar icon is missing. The per diem eReceipt thumbnail doesn't render, leaving a blank receipt area.
What is the root cause of that problem?
The
isPerDiemRequest()function insrc/libs/TransactionUtils/index.ts:252-262guards onObject.hasOwn(transaction, 'iouRequestType')before checking the value. When the staging server returns the transaction withiouRequestTypeset to a falsy value (null or empty string),Object.hasOwnreturnstrue, the value comparison againstCONST.IOU.REQUEST_TYPE.PER_DIEMfails, and the function returnsfalse. It never reaches the reliable server-side fallback at line 259-261 that checkscomment.type === 'customUnit' && comment.customUnit.name.This breaks the rendering chain at multiple points:
Main receipt view (
src/components/ReportActionItem/ReportActionItemImage.tsx:178):propsObj.isPerDiemRequestis set tofalse, soReceiptImageatsrc/components/ReceiptImage/index.tsx:201never takes theisEReceipt && isPerDiemRequestbranch, andEReceiptThumbnail(which renders the CalendarSolid icon atsrc/components/EReceiptThumbnail.tsx:112-119) is never mounted.Attachment view (
src/components/Attachments/AttachmentView/index.tsx:204):isPerDiemRequest(transaction)returns false, soPerDiemEReceiptis skipped entirely.Receipt cell in search (
src/components/TransactionItemRow/DataCells/ReceiptCell.tsx:40):isPerDiemevaluates to false.Receipt preview on hover (
src/components/TransactionItemRow/ReceiptPreview/index.tsx:38):isPerDiemEReceiptevaluates to false.Offending PR: this only reproduces on staging because PR #87244 reverted Onyx to 3.0.57, which preserves
iouRequestType: nullduring merge. production stayed on Onyx 3.0.58 which strips null values, soObject.hasOwnreturns false and the fallback runs correctly.What changes do you think we should make in order to solve the problem?
In
src/libs/TransactionUtils/index.ts, change the guard inisPerDiemRequest(and all sibling functions using the same pattern) from checking key existence to checking value truthiness:Apply the same change to all functions with the identical
Object.hasOwn(transaction, 'iouRequestType')pattern:isDistanceRequest(line 144)isDistanceTypeRequest(line 160)isMapDistanceRequest(line 189)isGPSDistanceRequest(line 199)isManualDistanceRequest(line 209)isOdometerDistanceRequest(line 225)isScanRequest(line 240)isPerDiemRequest(line 254)isTimeRequest(line 266)When
iouRequestTypeis null/undefined after server sync, the function falls through to the server-side field check, which is the authoritative source of truth for persisted transactions.What alternative solutions did you explore? (Optional)
Could strip the
iouRequestTypekey insuccessDatacallbacks after server sync. But that's fragile since Pusher updates can re-add it. The value-check fix makes detection logic robust regardless of what the server sends back.marufsharifi commentedon Apr 8, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-04-11 05:53:27 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Per diem expenses should show the per diem receipt icon when the user opens the receipt from the expense report, but synced per diem transactions sometimes render as a generic PDF receipt instead, so the per diem icon is missing.
What is the root cause of that problem?
The root cause is that the receipt surfaces only use the per diem visual path when the transaction is treated as an eReceipt or has no
receipt.source. Synced per diem transactions can have a real PDFreceipt.sourceandhasEReceipt: false, so they bypass the per diem-specific branches and fall back to the generic receipt/PDF UI.The first gate is in
src/components/ReportActionItem/ReportActionItemImage.tsx, whereisEReceiptis computed as!hasReceiptSource(transaction) && hasEReceipt(transaction)and the eReceipt props are only used when that value is true.App/src/components/ReportActionItem/ReportActionItemImage.tsx
Lines 149 to 180 in 02b2574
That depends on
hasReceiptSource()insrc/libs/TransactionUtils/index.ts, which returnstruefor any transaction withreceipt.source.App/src/libs/TransactionUtils/index.ts
Lines 553 to 563 in 02b2574
The second gate is in
src/components/ReceiptImage/index.tsx, where the per diem thumbnail path only runs whenisThumbnail || (isEReceipt && isPerDiemRequest).App/src/components/ReceiptImage/index.tsx
Lines 191 to 214 in 02b2574
The same assumption exists in
src/components/Attachments/AttachmentView/index.tsx, which only rendersPerDiemEReceiptwhenisPerDiemRequest(transaction) && !hasReceiptSource(transaction).App/src/components/Attachments/AttachmentView/index.tsx
Lines 204 to 208 in 02b2574
In simple terms: once the synced per diem transaction has a PDF
receipt.source, the current code stops treating it as a per diem receipt visually, even though it is still a per diem transaction.What changes do you think we should make in order to solve the problem?
We should keep the fix in App-side rendering logic and add one small helper that says whether a transaction should use the per diem receipt visual. That helper should return
truewhen the transaction is per diem and either:receipt.source, orreceipt.filenameorreceipt.sourceis a PDF)Then we should use that helper in the report preview and attachment view so synced PDF-backed per diem receipts still render the per diem visual path.
The new helper should be added in
src/libs/TransactionUtils/index.ts.App/src/libs/TransactionUtils/index.ts
Lines 140 to 142 in 02b2574
This keeps the logic centralized and avoids scattering PDF/per diem checks across multiple components.
Then update
src/components/ReportActionItem/ReportActionItemImage.tsxto use the helper and pass the result toReceiptImage.App/src/components/ReportActionItem/ReportActionItemImage.tsx
Lines 149 to 180 in 02b2574
This makes the report preview use the per diem visual path even when the synced transaction has a PDF source.
Then update
src/components/ReceiptImage/index.tsxso the per diem thumbnail branch can be selected directly by that new rendering flag.App/src/components/ReceiptImage/index.tsx
Lines 114 to 118 in 02b2574
App/src/components/ReceiptImage/index.tsx
Lines 136 to 214 in 02b2574
This keeps the existing rendering structure and only adds one narrow override for synced per diem PDF receipts.
Finally, update
src/components/Attachments/AttachmentView/index.tsxso the opened receipt view uses the same rule.App/src/components/Attachments/AttachmentView/index.tsx
Lines 204 to 208 in 02b2574
This keeps the preview and opened receipt consistent and fixes the exact repro path without changing server data or broader receipt behavior.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
None
What alternative solutions did you explore? (Optional)
What changes do you think we should make in order to solve the problem?
We should keep the fix very small and only update the two issue surfaces:
src/components/ReportActionItem/ReportActionItemImage.tsx, treat a per diem transaction with a PDF-backedreceipt.sourceas eligible for the existing per diem/eReceipt visual path.src/components/Attachments/AttachmentView/index.tsx, renderPerDiemEReceiptfor per diem transactions when they either:receipt.source, orreceipt.sourceThis keeps the fix localized to the repro path and does not change shared receipt utility semantics.
In
src/components/ReportActionItem/ReportActionItemImage.tsx, update the existingisEReceiptbranch to also cover PDF-backed per diem receipts.App/src/components/ReportActionItem/ReportActionItemImage.tsx
Lines 149 to 180 in 02b2574
This makes the report preview keep using the existing per diem thumbnail path for synced PDF-backed per diem receipts.
In
src/components/Attachments/AttachmentView/index.tsx, broaden the per diem branch so the opened receipt usesPerDiemEReceiptfor the same synced PDF-backed shape.App/src/components/Attachments/AttachmentView/index.tsx
Lines 204 to 208 in 02b2574
This keeps the preview and opened receipt consistent and fixes the exact repro path without changing server data,
hasEReceipt(), orhasReceiptSource().Video demo of repro:
issue-repro.webm
Video demo of fix:
fix-demo.mp4
github-actions commentedon Apr 8, 2026
28 remaining items
alexanderxfgl-bit commentedon Apr 9, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
melvin-bot commentedon Apr 9, 2026
📣 @alexanderxfgl-bit! 📣
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:
github-actions commentedon Apr 9, 2026
marufsharifi commentedon Apr 11, 2026
Proposal updated and aligned with the latest confirmed issue behavior and expected outcome.
yuvrajangadsingh commentedon Apr 11, 2026
@FitseTLT updated my proposal to identify PR #87244 as the offending revert. the Onyx 3.0.57 downgrade preserves
iouRequestType: nullwhich triggers theObject.hasOwnshort-circuit in all 9 request-type functions.JS00001 commentedon Apr 13, 2026
Looks like @rlinoz is handling this one
rlinoz commentedon Apr 13, 2026
Actually related to this https://github.com/Expensify/Expensify/issues/622643
rlinoz commentedon Apr 21, 2026
This is done.