-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Follow up: make SEARCH_REPORT and REPORT_WITH_ID routes compliant with routing philosophies #69536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Follow up: make SEARCH_REPORT and REPORT_WITH_ID routes compliant with routing philosophies #69536
Conversation
|
I'll review it today |
|
PR doesn’t have any new product considerations. Removing the tag and unsubscribing myself. |
| const optimisticReportID = generateReportID(); | ||
| Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(optimisticReportID, undefined, undefined, action.reportActionID, transactionID, Navigation.getActiveRoute())); | ||
| const transactionThreadReport = createTransactionThreadReport(iouReport, action); | ||
| Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(transactionThreadReport?.reportID, undefined, undefined, Navigation.getActiveRoute())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before, we had this condition to decide whether to call openReport or not.
App/src/pages/home/ReportScreen.tsx
Lines 497 to 507 in 8b28384
| const {moneyRequestReportActionID, transactionID, iouReportID} = route.params; | |
| // When we get here with a moneyRequestReportActionID and a transactionID from the route it means we don't have the transaction thread created yet | |
| // so we have to call OpenReport in a way that the transaction thread will be created and attached to the parentReportAction | |
| if (transactionID && currentUserEmail && !report) { | |
| const iouReport = getReportOrDraftReport(iouReportID); | |
| const iouAction = getReportAction(iouReportID, moneyRequestReportActionID); | |
| const optimisticTransactionThread = buildTransactionThread(iouAction, iouReport, undefined, reportIDFromRoute); | |
| openReport(reportIDFromRoute, undefined, [currentUserEmail], optimisticTransactionThread, moneyRequestReportActionID, false, [], undefined, transactionID); | |
| return; | |
| } |
But with this change createTransactionThreadReport(iouReport, action);, I saw it's calling openReport everytime here. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before:
We passed to the ReportScreen transactionID, iouReportID, iouReportActionID to identify the report should be created (the OpenReport was called in the ReportScreen with all of the necessary params)
After:
We create the report (call OpenReport with necessary params) and navigate to the ReportScreen. On the ReportScreen, the OpenReport isn't called extra time because the hook stops in this condition.
| const optimisticTransactionThread = buildTransactionThread(iouAction, moneyRequestReport); | ||
| threadID = optimisticTransactionThread.reportID; | ||
| openReport(threadID, undefined, session?.email ? [session?.email] : [], optimisticTransactionThread, iouAction?.reportActionID); | ||
| const createdTransactionThreadReport = createTransactionThreadReport(moneyRequestReport, iouAction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that createdTransactionThreadReport optimistic data? I think we should change the variable name to make it more clear here, probably createdOptimisticTransactionThreadReport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createTransactionThreadReport method doesn't just build optimistic data, it actually creates the report, so I think it's okay to name it like this.
|
I'll do some testing in the meantime, will let you knnow if I find any bugs. |
|
@hungvu193 Will you be able to finish the review today? |
Hopefully Yes, I'm still doing tests |
|
Review duplicate button displays briefly, then disappears:
Screen.Recording.2025-09-02.at.21.21.10.movScreen.Recording.2025-09-02.at.21.25.03.mov |
|
@VickyStash I couldn't reproduce #69536 (comment) consistently, and the issue when |
|
The review duplicates flow is unstable on main too. Found several bugs but unrelated to this PR. |
Same, I was able to reproduce the reported issues on the main too. It feels like it relates to optimistic threads creation so I'm checking |
|
Okay, I've tested it more and was able to reproduce similar behaviour on the prod with prod_bugs.mp4Steps:
So I think this bug should be investigated separately! |
|
Yeah I also noticed it on main. All good. I'll complete the checklist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall seems like a great simplification, but subscribing to the whole reports collection on the search page seems like it might cause a lot more re-renders.
roryabraham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, thank you so much!
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-09-03.at.14.57.13.movAndroid: mWeb ChromeScreen.Recording.2025-09-03.at.14.11.00.moviOS: HybridAppScreen.Recording.2025-09-03.at.14.26.07.moviOS: mWeb SafariScreen.Recording.2025-09-03.at.14.00.47.movMacOS: Chrome / SafariScreen.Recording.2025-09-03.at.13.54.22.movScreen.Recording.2025-09-03.at.13.55.43.movMacOS: DesktopScreen.Recording.2025-09-03.at.13.58.13.mov |
iwiznia
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not review, Rory already did and there was no push to the branch afterwards, not sure why GH is not showing it as reviewed in the UI
|
✋ 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/iwiznia in version: 9.2.2-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.2.2-8 🚀
|
Explanation of Change
Make
SEARCH_REPORTandREPORT_WITH_IDroutes compliant with routing philosophiesFixed Issues
$ #69385
PROPOSAL: N/A
Tests
noOptimisticTransactionThreadsbeta.Block transaction thread report creationtoggle (you can also turn it on in the troubleshoot modal CMD + D)❗ Note:
There are two known issues:
Offline tests
Same, as in the
TestssectionQA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same, as in the
TestssectionPR 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))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