Repository navigation
Fix duplicates resolution when no optimistic transaction threads are created - #71681
Merged
iwiznia merged 6 commits intoOct 6, 2025
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@hungvu193 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] |
roryabraham
reviewed
Oct 3, 2025
roryabraham
approved these changes
Oct 3, 2025
iwiznia
approved these changes
Oct 3, 2025
Contributor
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-10-05.at.09.53.52.movAndroid: mWeb ChromeScreen.Recording.2025-10-05.at.00.47.01.moviOS: HybridAppScreen.Recording.2025-10-05.at.00.41.18.moviOS: mWeb SafariScreen.Recording.2025-10-05.at.00.26.08.movMacOS: Chrome / SafariScreen.Recording.2025-10-05.at.00.16.04.movMacOS: DesktopScreen.Recording.2025-10-05.at.00.24.19.mov |
hungvu193
approved these changes
Oct 5, 2025
Contributor
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
73 tasks done
Contributor
|
🚀 Deployed to staging by https://github.com/iwiznia in version: 9.2.24-0 🚀
|
Contributor
|
🚀 Deployed to staging by https://github.com/iwiznia in version: 9.2.26-0 🚀
|
Contributor
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.2.26-7 🚀
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Fixes this issue: #67886 (comment)
Context: You have two duplicate transactions. These transactions don't have transaction threads. You resolve duplicates.
IOU.mergeDuplicates method is called. What happens:
App/src/libs/actions/IOU.ts
Lines 11579 to 11583 in 49f9ce2
childReportIDto the optimisticTransactionThreadReportIDApp/src/libs/actions/IOU.ts
Lines 11759 to 11763 in 49f9ce2
So, both updates are applied in the one optimisticData, that later applied in the one Onyx.update
If then, on the ReportScreen you check, you will see, that transactions updates and the reportActions updates are not applied in the same time. Firstly, in one render transactions are updates, and then, in another render reportActions are updated.
Due to this, the
transactionThreadReportIDis incorrectly calculated (during the first re-render, when transactions updates are applied, and reportActions updates are still not), ending up in triggering the hook to create one more extra optimistic transaction thread.App/src/pages/home/ReportScreen.tsx
Line 318 in 49f9ce2
Why it happens?
The batching updates logic was working in the Onyx only for withOnyx subscribers. There is no logic to batch
useOnyxupdates. While react concurrent rendering can batch some updates automatically, it doesn't always happen.Fixed Issues
$ #67886
PROPOSAL: N/A
Tests
noOptimisticTransactionThreadsbeta.Block transaction thread report creationtoggle (you can also turn it on in the troubleshoot modal CMD + D)Keep this oneon the second expense (it's important to select the second one)Offline tests
Same, as in the Tests section
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same, as in the Tests section
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
android.mp4
Android: mWeb Chrome
android_web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios_web.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4