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-06-16][$250] Approve button appears when the receipt is scanning #62743
Version Number: 9.1.51-0 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@iwiznia Slack conversation (hyperlinked to channel name): #Expensify-bugs
Action Performed:
Precondition: Disable delay submissions
Create a workspace
Disable delay submissions
Click create expense, select scan option and upload a receipt
Observe the button
Expected Result:
Approve button should not appear while scanning
Actual Result:
Approve button appears
Workaround:
unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Platforms Tested:
On which of our officially supported platforms was this issue tested:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidenceScreen.Recording.2025-05-23.at.10.46.49.AM.movRecording.1272.mp4
Please re-state the problem that we are trying to solve in this issue.
Approve button appears when the receipt is scanning
What is the root cause of that problem?
This is an intentional behavior the TL;DR :
Submitters must wait until all receipts finish scanning before they can submit an expense report
Approvers can approve expense reports even while receipts are still scanning, trusting that the scanning will complete and populate the necessary fields
This design allows for a more flexible approval workflow where approvers don't have to wait for all scanning to complete, while still ensuring that submitters have complete information before submission
The scanning status is still shown in the chat preview as Receipt /Scanning, but the approval workflow can proceed independently of the scanning process.
Submit Button Logic
The submit functionality explicitly prevents submission while receipts are scanning:
here's no explicit check for scanning receipts in the approve logic , meaning hasMissingSmartscanFields Excludes Scanning Receipts
What changes do you think we should make in order to solve the problem?
i applied the exact same proven logic pattern (isAnyReceiptBeingScanned = reportTransactions?.some(transaction => isReceiptBeingScanned(transaction))) that already exists in canSubmit and isSubmitAction to all three approve functions (canApprove, isApproveAction in ReportPrimaryActionUtils, and isApproveAction in ReportSecondaryActionUtils) , This leverages the existing the tested isReceiptBeingScanned function that properly detects both SCAN_READY and SCANNING states, ensuring that approve buttons are hidden during scanning just like submit buttons already are. this works cause it follows established architectural patterns & has comprehensive test coverage for both scanning states, and creates consistent behavior across all expense report actions without introducing any breaking changes or new complex logic
changed the title [-]`Approve` button appears when the receipt is scanning[/-][+][$250] `Approve` button appears when the receipt is scanning[/+]on May 27, 2025
changed the title [-][Due for payment 2025-06-16] [Due for payment 2025-06-13] [$250] `Approve` button appears when the receipt is scanning[/-][+][Due for payment 2025-06-16][$250] `Approve` button appears when the receipt is scanning[/+]on Jun 17, 2025
[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: no need this was a edge case from a large feature PR might now be considered in the implementation phase
[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. recomended
[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:
Disable delay submissions in WS settings
Test:
Create a workspace
Disable delay submissions
Click create expense, select scan option and upload a receipt
Observe the button
Expected Result: Approve button should not appear while scanning
Activity
melvin-bot commentedon May 25, 2025
Triggered auto assignment to @mallenexpensify (
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.bernhardoj commentedon May 25, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Approve button shows while scanning.
What is the root cause of that problem?
In
canApprovelogic, we don't have any logic to check if the request is still scanning.App/src/libs/ReportPreviewActionUtils.ts
Lines 83 to 88 in 526a0e4
What changes do you think we should make in order to solve the problem?
We can follow the logic from
IOU.canApproveIOUby checking every transactions withisPendingCardOrScanningTransactionand return early if true.App/src/libs/actions/IOU.ts
Lines 8984 to 8987 in 526a0e4
or we can only check if it's scanning, just like the
canSubmitlogic.App/src/libs/ReportPreviewActionUtils.ts
Line 54 in 526a0e4
(hasOnlyPendingCardOrScanningTransactions also checks if it's partial, but BE allow approving partial transaction)
We need to apply it to ReportPrimaryActionUtils and ReportSecondaryActionUtils too.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can test canApprove and assert it returns false if it's scanning.
mavrickdeveloper commentedon May 25, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Approve button appears when the receipt is scanning
What is the root cause of that problem?
This is an intentional behavior the TL;DR :
Submitters must wait until all receipts finish scanning before they can submit an expense report
Approvers can approve expense reports even while receipts are still scanning, trusting that the scanning will complete and populate the necessary fields
This design allows for a more flexible approval workflow where approvers don't have to wait for all scanning to complete, while still ensuring that submitters have complete information before submission
The scanning status is still shown in the chat preview as Receipt /Scanning, but the approval workflow can proceed independently of the scanning process.
Submit Button Logic
The submit functionality explicitly prevents submission while receipts are scanning:
App/src/libs/ReportPreviewActionUtils.ts
Lines 42 to 63 in 526a0e4
Notice the !isAnyReceiptBeingScanned check that prevents submission when any receipt is scanning.
On the other hand Approve Button Logic
the approve functionality does NOT have this same restriction:
App/src/libs/ReportPreviewActionUtils.ts
Lines 65 to 87 in 526a0e4
here's no explicit check for scanning receipts in the approve logic , meaning hasMissingSmartscanFields Excludes Scanning Receipts
What changes do you think we should make in order to solve the problem?
i applied the exact same proven logic pattern (isAnyReceiptBeingScanned = reportTransactions?.some(transaction => isReceiptBeingScanned(transaction))) that already exists in canSubmit and isSubmitAction to all three approve functions (canApprove, isApproveAction in ReportPrimaryActionUtils, and isApproveAction in ReportSecondaryActionUtils) , This leverages the existing the tested isReceiptBeingScanned function that properly detects both SCAN_READY and SCANNING states, ensuring that approve buttons are hidden during scanning just like submit buttons already are. this works cause it follows established architectural patterns & has comprehensive test coverage for both scanning states, and creates consistent behavior across all expense report actions without introducing any breaking changes or new complex logic
We should also fix it in ReportPrimaryActionUtils.ts & ReportSecondaryActionUtils.ts
*ReportPrimaryActionUtils.ts :
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
this change requires a new test case imo in ReportPreviewActionUtilsTest.ts , im including it, here it is :
[-]`Approve` button appears when the receipt is scanning[/-][+][$250] `Approve` button appears when the receipt is scanning[/+]melvin-bot commentedon May 27, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021927434948367177304
melvin-bot commentedon May 27, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ishpaul777 (
External)31 remaining items
melvin-bot commentedon Jun 16, 2025
@mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
ishpaul777 commentedon Jun 16, 2025
will fill checklist today
[-][Due for payment 2025-06-16] [Due for payment 2025-06-13] [$250] `Approve` button appears when the receipt is scanning[/-][+][Due for payment 2025-06-16][$250] `Approve` button appears when the receipt is scanning[/+]mallenexpensify commentedon Jun 17, 2025
Contributor: @bernhardoj due $250 via NewDot
Contributor+: @ishpaul777 due $250 via NewDot
@ishpaul777 please post checklist, thx
bernhardoj commentedon Jun 17, 2025
Requested in ND.
ishpaul777 commentedon Jun 17, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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: https://github.com/Expensify/App/pull/58084/files#r2153357071
[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: no need this was a edge case from a large feature PR might now be considered in the implementation phase
[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. recomended
[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 Jun 20, 2025
@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!
mallenexpensify commentedon Jun 21, 2025
Thx @ishpaul777 test created
JmillsExpensify commentedon Jul 2, 2025
$250 approved for @bernhardoj
garrettmknight commentedon Jul 3, 2025
$250 approved for @ishpaul777