fix: Submit button appears briefly after the SmartScan fails#84241
fix: Submit button appears briefly after the SmartScan fails#84241carlosmiceli merged 5 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@ZhenjaHorbach Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
src/libs/ReportPreviewActionUtils.ts
Outdated
|
|
||
| const isAnyReceiptBeingScanned = transactions?.some((transaction) => isScanning(transaction)); | ||
|
|
||
| const hasSmartScanFailedWithMissingFields = transactions?.some( |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The same hasSmartScanFailedWithMissingFields logic is duplicated identically across 4 files:
src/libs/ReportPreviewActionUtils.ts(line 50)src/libs/ReportPrimaryActionUtils.ts(line 126)src/libs/ReportSecondaryActionUtils.ts(line 215)src/libs/actions/IOU/index.ts(line 10544)
All four perform the same check: transactions.some(t => isScanRequest(t) && t.receipt.state === SCAN_FAILED && hasMissingSmartscanFields(t, report)). This should be extracted into a shared utility function in TransactionUtils (where isScanRequest and hasMissingSmartscanFields already live).
Suggested fix -- add a helper in src/libs/TransactionUtils/index.ts:
function hasSmartScanFailedWithMissingFields(
transactions: Transaction[],
report: OnyxEntry<Report>,
): boolean {
return transactions.some(
(transaction) =>
isScanRequest(transaction) &&
transaction?.receipt?.state === CONST.IOU.RECEIPT_STATE.SCAN_FAILED &&
hasMissingSmartscanFields(transaction, report),
);
}Then replace all four inline checks with a single call to this helper.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
Updated and re-tested 👍
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Makes sense for product
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari2026-03-09.14.40.12.mov |
|
LGTM! |
|
🚧 @carlosmiceli has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.3.34-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.34-2 🚀
|
Explanation of Change
This PR adds a synchronous check for transactions with
receipt.state === SCAN_FAILEDandhasMissingSmartscanFields, so the Submit button is hidden as soon as SmartScan fails, without waiting for violation data. This prevents the Submit button from flickeringFixed Issues
$ #83573
PROPOSAL: #83573 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Precondition: The workspace enables the workflow and setting the default approver
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android-App.mp4
Android: mWeb Chrome
Android-mWeb.mp4
iOS: Native
iOS-App.mp4
iOS: mWeb Safari
iOS-mWeb.mp4
MacOS: Chrome / Safari
MacOS-Chrome.mp4