fix: Create 31 expenses after turn back confirm create 30 expenses and upload new receipt - #81015
Conversation
…d upload new receipt
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@linhvovan29546 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0769283642
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const [draftTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {canBeMissing: true}); | ||
| const [isMultiScanEnabled, setIsMultiScanEnabled] = useState((optimisticTransactions ?? []).length > 1); | ||
| const [isMultiScanEnabled, setIsMultiScanEnabled] = useState(false); |
There was a problem hiding this comment.
Preserve multi-scan state when drafts already exist
Initializing isMultiScanEnabled to false ignores the case where the draft already contains multiple receipt transactions (e.g., user scanned multiple receipts, went to confirmation, then navigated back). In that state, the next upload will hit removeDraftTransactions(true) because !isMultiScanEnabled && isStartingScan (see src/pages/iou/request/step/IOURequestStepScan/index.tsx lines 407-409), which clears the existing drafts and drops previously scanned receipts instead of letting the user append. This regression only appears when a multi-receipt draft is reopened, but it results in data loss. Consider seeding isMultiScanEnabled from the current draft transaction count so multi-scan remains enabled when multiple drafts exist.
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-01-31.at.14.35.58.mp4Android: mWeb ChromeScreen.Recording.2026-01-31.at.14.28.07.mp4iOS: HybridAppScreen.Recording.2026-01-31.at.14.47.56.moviOS: mWeb SafariScreen.Recording.2026-01-31.at.14.26.18.movMacOS: Chrome / SafariScreen.Recording.2026-01-31.at.14.21.16.mov |
|
@nkdengineer Please add the missing attachments to the PR description. |
There was a problem hiding this comment.
@nkdengineer Please add the missing attachments to the PR description.
|
@linhvovan29546 I don't know the way to drag and drop on a mobile device. Do we have a way for this? |
Just select multiple attachments from the gallery for testing |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Fix makes sense 👍
|
@linhvovan29546 I updated. |
|
✋ 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/mjasikowski in version: 9.3.11-25 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.3.12-1 🚀
|
Explanation of Change
fix: Create 31 expenses after turn back confirm create 30 expenses and upload new receipt
Fixed Issues
$ #80581
PROPOSAL: #80581 (comment)
Tests
Offline tests
Same
QA Steps
Same as test
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
Screen.Recording.2026-02-03.at.11.56.27.mov
Android: mWeb Chrome
Screen.Recording.2026-02-03.at.11.53.11.mov
iOS: Native
Screen.Recording.2026-02-03.at.11.58.06.mov
iOS: mWeb Safari
Screen.Recording.2026-02-03.at.11.57.01.mov
MacOS: Chrome / Safari
Screen.Recording.2026-01-30.at.21.36.02.mov