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 2025-11-14] Investigate violations under a receipt on the one expense report view not showing sometimes #72444
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Please re-state the problem that we are trying to solve in this issue.
When a user views an expense report, critical violation messages that should appear directly under a receipt are sometimes missing. This inconsistent behavior can confuse the user, as they might not be aware of important issues with their expense that require action. The issue appears to resolve itself upon a fresh session (like in Incognito mode), suggesting a problem related to the component's loading state rather than a lack of data.
What is the root cause of that problem?
The root cause is an incorrect dependency in the rendering logic within the MoneyRequestReceiptView.tsx component. The display of the violation messages is incorrectly coupled with the loading state of the receipt image.
The current logic to render the violation messages is as follows:
show_violations IF (there_are_violations_to_show) AND (a_receipt_exists) AND (the_image_has_finished_loading)
The problematic condition is the final one: (the_image_has_finished_loading). This creates a race condition. If the violation data loads quickly but the receipt image loads slowly (or fails to load entirely), the critical violation messages will never be rendered because the component is still waiting for a non-critical image.
This is a logical flaw, as the textual violation information is not dependent on the visual receipt image itself. They should render independently.
What changes do you think we should make in order to solve the problem?
The solution is to decouple the rendering of violation messages from the image's loading state. We should remove the !isLoading check from the conditional statement that controls the visibility of receiptAuditMessagesRow.
This ensures that as soon as the violation data is available, it will be displayed to the user, regardless of how long the receipt image takes to load.
// Problem: The "!isLoading" condition blocks violation messages from rendering
// until the image has completely loaded.
{!!shouldShowAuditMessage && hasReceipt && !isLoading && receiptAuditMessagesRow}
Proposed Change:
// Fix: Remove the "!isLoading" dependency. Violation messages will now
// render as soon as they are available.
{!!shouldShowAuditMessage && hasReceipt && receiptAuditMessagesRow}
This change is simple, direct, and addresses the root cause of the issue by correcting the component's rendering logic.
What alternative solutions did you explore? (Optional)
Setting isLoading to false on image load failure: One alternative is to add an onError handler to the image component to ensure isLoading is set to false if the image fails to load. While this would solve the problem for failed images, it would not fix the issue for images that are simply slow to load. The user would still have to wait for the image, which is not ideal.
Making the check conditional on the view: Another idea was to only apply the !isLoading check in certain layouts (e.g., when the receipt is not filling the full space). This is a symptom-based fix, not a root cause fix. It would make the code more complex and would not solve the underlying logical flaw, which could reappear in other layouts or future refactors.
Ultimately, both alternatives are partial or indirect fixes. The most robust solution is to remove the incorrect dependency entirely, as proposed above.
@dukenv0307 , I tested by mocking the code and sending empty string as source for the image, and the image load failed and the violations where also not shown. So the RCA hypothesis is correct. And also tested with the isLoading state which is also working.
could you kindly update your proposal with all the information discussed in the slack?
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.46-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@abdulrahuman5196 / @dukenv0307@greg-schroeder The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
I don't think we can create regression test for this issue, since it expects the image load to fail which rarely happens.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue
Activity
melvin-bot commentedon Oct 13, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (
External)melvin-bot commentedon Oct 13, 2025
Triggered auto assignment to @greg-schroeder (
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.dukenv0307 commentedon Oct 13, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-10-13 11:27:11 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Investigate violations under a receipt on the one expense report view not showing sometimes
What is the root cause of that problem?
Sometimes the receipt isn't loaded, so the violation doesn't show here
App/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
Line 322 in 92086c0
What changes do you think we should make in order to solve the problem?
We can remove
isLoadingcondition here. Or we can setisLoadingtofalsewhen the image fails to loadApp/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
Line 322 in 92086c0
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)
Only checking the
isLoadingstate if we're in wide RHP viewApp/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
Line 322 in 92086c0
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
RKCODE2015 commentedon Oct 14, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user views an expense report, critical violation messages that should appear directly under a receipt are sometimes missing. This inconsistent behavior can confuse the user, as they might not be aware of important issues with their expense that require action. The issue appears to resolve itself upon a fresh session (like in Incognito mode), suggesting a problem related to the component's loading state rather than a lack of data.
What is the root cause of that problem?
The root cause is an incorrect dependency in the rendering logic within the
MoneyRequestReceiptView.tsxcomponent. The display of the violation messages is incorrectly coupled with the loading state of the receipt image.The current logic to render the violation messages is as follows:
The problematic condition is the final one: (
the_image_has_finished_loading). This creates a race condition. If the violation data loads quickly but the receipt image loads slowly (or fails to load entirely), the critical violation messages will never be rendered because the component is still waiting for a non-critical image.This is a logical flaw, as the textual violation information is not dependent on the visual receipt image itself. They should render independently.
What changes do you think we should make in order to solve the problem?
The solution is to decouple the rendering of violation messages from the image's loading state. We should remove the
!isLoadingcheck from the conditional statement that controls the visibility ofreceiptAuditMessagesRow.This ensures that as soon as the violation data is available, it will be displayed to the user, regardless of how long the receipt image takes to load.
App/src/components/ReportActionItem/MoneyRequestReceiptView.tsxCurrent Code:
Proposed Change:
This change is simple, direct, and addresses the root cause of the issue by correcting the component's rendering logic.
What alternative solutions did you explore? (Optional)
Setting
isLoadingtofalseon image load failure: One alternative is to add anonErrorhandler to the image component to ensureisLoadingis set tofalseif the image fails to load. While this would solve the problem for failed images, it would not fix the issue for images that are simply slow to load. The user would still have to wait for the image, which is not ideal.Making the check conditional on the view: Another idea was to only apply the
!isLoadingcheck in certain layouts (e.g., when the receipt is not filling the full space). This is a symptom-based fix, not a root cause fix. It would make the code more complex and would not solve the underlying logical flaw, which could reappear in other layouts or future refactors.Ultimately, both alternatives are partial or indirect fixes. The most robust solution is to remove the incorrect dependency entirely, as proposed above.
abdulrahuman5196 commentedon Oct 14, 2025
@dukenv0307 , I tested by mocking the code and sending empty string as source for the image, and the image load failed and the violations where also not shown. So the RCA hypothesis is correct. And also tested with the isLoading state which is also working.
could you kindly update your proposal with all the information discussed in the slack?
abdulrahuman5196 commentedon Oct 14, 2025
@dukenv0307 's proposal here #72444 (comment) looks good and works well.
🎀 👀 🎀
C+ Reviewed
11 remaining items
melvin-bot commentedon Nov 7, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Nov 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.46-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-11-14. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Nov 7, 2025
@abdulrahuman5196 / @dukenv0307 @greg-schroeder The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
abdulrahuman5196 commentedon Nov 11, 2025
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: Doesn't seem to be a regression. Implementation miss - https://github.com/Expensify/App/pull/69875/files#r2515180999
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
I don't think we can create regression test for this issue, since it expects the image load to fail which rarely happens.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
melvin-bot commentedon Nov 14, 2025
Payment Summary
Upwork Job
BugZero Checklist (@greg-schroeder)
greg-schroeder commentedon Nov 18, 2025
Payment summary above is good ☝️
quinthar commentedon Nov 28, 2025
Approved $250 to @abdulrahuman5196
twisterdotcom commentedon Dec 2, 2025
@dukenv0307 has submitted payment for this report on ND here.
SO: https://stackoverflowteams.com/c/expensify/questions/7582
Zapier Logs
Run ID: 00040eee-ff1e-aab4-89fc-21b617a108f4