[CP Staging] Use ref to check if transactions are empty in SearchContext#63550
Conversation
|
@DylanDylann 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] |
|
Perf-test fail unrelated to this PR. |
|
Reviewing |
|
Got it |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeScreen.Recording.2025-06-05.at.22.51.32.moviOS: HybridAppiOS: mWeb SafariScreen.Recording.2025-06-05.at.22.48.04.movMacOS: Chrome / SafariScreen.Recording.2025-06-05.at.22.46.06.movMacOS: Desktop |
|
I will copy-paste from our chat for potential future readers:
But it was not added because That caused the following: We have a cycle there so the screen above would re-run callback at every call(!) Thanks to ref |
|
The test failure is unrelated |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
…-search-context-a-little-more [CP Staging] Use ref to check if transactions are empty in SearchContext (cherry picked from commit 0e9a19d) (cherry-picked to staging by mountiny)
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.1.59-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.1.59-7 🚀
|
Explanation of Change
Removing
clearNestedTransactions/setSelectedTransactionsfromuseFocusEffect->useCallbackinMoneyRequestReportTransactionListfixed bug mentioned here but caused this issue.That is because
setSelectedTransactionshassearchContextData.selectedTransactionIDs.lengthinuseCallbackdependency array in order to skip setting state to empty array when it is already empty. That is fixed usingrefto store information whether array is empty already and cleaningsetSelectedTransactionsdependency array.That fixes both issues & optimizes
SearchContexteven more.Fixed Issues
$ #63505
PROPOSAL: N/A
Tests
Offline tests
Same as tests.
QA Steps
Same as tests.
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))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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Web.mov
MacOS: Desktop