Refactor ConfirmModal usage to useConfirmModal in Search pages 2#79908
Refactor ConfirmModal usage to useConfirmModal in Search pages 2#79908roryabraham merged 7 commits intoExpensify:mainfrom
Conversation
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.
|
|
@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] |
|
@roryabraham 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] |
|
For
|
src/components/Search/index.tsx
Outdated
| selectedTransactions={selectedTransactions} | ||
| shouldPreventLongPressRow={isChat || isTask} | ||
| onDEWModalOpen={handleDEWModalOpen} | ||
| onDEWModalOpen={() => { |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
Unnecessary wrapper function creates code duplication. handleDEWModalOpen can be passed directly.
Suggested fix:
onDEWModalOpen={handleDEWModalOpen}There was a problem hiding this comment.
Use this will cause the error since handleDEWModalOpen type is () => Promise.
There was a problem hiding this comment.
I think we should fix this one - because Search/index.tsx isn't compiled this is changing from a stable value to a non-stable value, which will re-render the SearchList subtree on every render, even if memoized.
Easiest would be to change the handleDEWModalOpen prop type
There was a problem hiding this comment.
@roryabraham Another approach is use Promise instead of async/await inside handleDEWModalOpen. What do you think?
|
No product considerations, removing my review |
src/pages/Search/EmptySearchView.tsx
Outdated
| // Default 'Folder' lottie animation, along with its background styles | ||
| const defaultViewItemHeader = useSearchEmptyStateIllustration(); | ||
|
|
||
| // eslint-disable-next-line react-hooks/preserve-manual-memoization |
There was a problem hiding this comment.
Could you please update the branch to the latest version of main and try to remove this line?
src/pages/Search/SearchTypeMenu.tsx
Outdated
| can play its exit animation instead of removing it instantly. */} | ||
| {DeleteConfirmModal} | ||
| </> | ||
| <>{renderSavedSearchesSection(savedSearchesMenuItems)}</> |
src/pages/Search/EmptySearchView.tsx
Outdated
| const handleCreateExpense = () => { | ||
| interceptAnonymousUser(() => { | ||
| if (shouldRedirectToExpensifyClassic) { | ||
| handleRedirectToExpensifyClassic(); | ||
| return; | ||
| } | ||
| startMoneyRequest(CONST.IOU.TYPE.CREATE, generateReportID()); | ||
| }); |
There was a problem hiding this comment.
These are two almost identical functions
Let's just create a new function and pass IOU.TYPE parameter
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-01-22.12.35.27.mov2026-01-22.12.36.00.mov2026-01-22.12.36.46.movAndroid: mWeb Chrome2026-01-22.12.41.49.mov2026-01-22.12.42.34.mov2026-01-22.12.43.10.moviOS: HybridApp2026-01-22.12.26.08.mov2026-01-22.12.26.26.mov2026-01-22.12.27.04.moviOS: mWeb Safari2026-01-22.12.22.14.mov2026-01-22.12.22.50.mov2026-01-22.12.23.18.movMacOS: Chrome / Safari2026-01-22.12.08.00.mov2026-01-22.12.17.26.mov2026-01-22.12.18.16.mov |
|
But changes work well! |
|
The test is flaky since we don't change anything related to the test function. |
|
LGTM! |
Yeah |
|
@nkdengineer |
src/components/Search/index.tsx
Outdated
| selectedTransactions={selectedTransactions} | ||
| shouldPreventLongPressRow={isChat || isTask} | ||
| onDEWModalOpen={handleDEWModalOpen} | ||
| onDEWModalOpen={() => { |
There was a problem hiding this comment.
I think we should fix this one - because Search/index.tsx isn't compiled this is changing from a stable value to a non-stable value, which will re-render the SearchList subtree on every render, even if memoized.
Easiest would be to change the handleDEWModalOpen prop type
|
✋ 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/roryabraham in version: 9.3.10-0 🚀
|
|
@nkdengineer or @roryabraham, could you please advise how to set up the preconditions for the first two scenarios? |
|
@IuliiaHerets For test 1: after creating a new workspace of new account, don't create any expense, go to OldDot and run this script to disable policy expense chat Screen.Recording.2026-01-28.at.14.23.12.movFor test 2: @ZhenjaHorbach can help |
Unfortunately, I tested locally using mocks |
|
@ZhenjaHorbach can we skip test 2? |
I think we can skip this since we just refactor the logic and we verified it works on dev. |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.10-6 🚀
|
Explanation of Change
Refactor ConfirmModal usage to useConfirmModal in Search pages 2
Fixed Issues
$ #76694
PROPOSAL:
Tests
Precondition: Has at least one group workspace and the policy expense chat is disabled, and doesn't have any transaction
Create expensePrecondition: The approval mode of the workspace is
DYNAMIC_EXTERNALPrecondition: Have some saved searches
Offline tests
None
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-01-19.at.22.53.46.mov
Android: mWeb Chrome
Screen.Recording.2026-01-19.at.22.51.59.mov
iOS: Native
Screen.Recording.2026-01-19.at.22.54.32.mov
iOS: mWeb Safari
Screen.Recording.2026-01-19.at.22.48.12.mov
MacOS: Chrome / Safari
Screen.Recording.2025-12-06.at.23.55.28.mov
Screen.Recording.2025-12-06.at.23.59.14.mov
Screen.Recording.2025-12-07.at.00.00.24.mov