[No QA] Refactor: Extract confirmReadyToOpenApp effect into reusable hook#81618
[No QA] Refactor: Extract confirmReadyToOpenApp effect into reusable hook#81618
Conversation
This extracts the confirmReadyToOpenApp() effect from DomainInitialPage into a focused, reusable custom hook called useConfirmReadyToOpenApp. The existing code violated CLEAN-REACT-PATTERNS-4 by mixing unrelated effects (data fetching + app lifecycle) in the same component. This pattern is also duplicated across 10+ pages. Changes: - Add src/hooks/useConfirmReadyToOpenApp.ts - Update DomainInitialPage to use the new hook - Add unit tests for the hook No behavioral changes - the refactored code executes identically. Co-authored-by: Cursor <cursoragent@cursor.com>
This refactors the following pages to use the new useConfirmReadyToOpenApp hook, eliminating duplicated useEffect patterns: - SearchPage - HomePage - WorkspaceInitialPage - SidebarLinks No behavioral changes - all pages execute the same logic at mount time. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
|
1 similar comment
|
@eh2077 can you please review and test? |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
Yes, I'll review it today |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-02-08.at.9.38.37.PM.movAndroid: mWeb ChromeScreen.Recording.2026-02-08.at.9.35.30.PM.moviOS: HybridAppScreen.Recording.2026-02-08.at.9.38.05.PM.moviOS: mWeb SafariScreen.Recording.2026-02-08.at.9.36.24.PM.movMacOS: Chrome / SafariScreen.Recording.2026-02-08.at.9.34.32.PM.mov |
|
@marcochavezf 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] |
|
No product review needed |
Co-authored-by: Eric Han <117511920+eh2077@users.noreply.github.com>
|
@MariaHCD @marcochavezf Ready for you |
…sify/App into vit-refactor-confirmReadyToOpenApp
…signatures Co-authored-by: Cursor <cursoragent@cursor.com>
|
Oops, there are new merge conflicts |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚧 @MariaHCD has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ 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/MariaHCD in version: 9.3.17-0 🚀
|
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.17-9 🚀
|
Explanation of Change
This PR extracts the
confirmReadyToOpenApp()effect fromDomainInitialPageinto a focused, reusable custom hook calleduseConfirmReadyToOpenApp.Why this change:
confirmReadyToOpenApp()pattern is duplicated across 10+ pages - this creates a reusable hook that can be adopted by other pagesWhat changed:
src/hooks/useConfirmReadyToOpenApp.ts- a focused hook that signals the app is ready to openDomainInitialPage.tsxto use the new hook instead of an inlineuseEffectNo behavioral changes - the refactored code executes identically at runtime. This is purely a code quality improvement.
Fixed Issues
$ #81762
Tests
DomainInitialPageloads correctly and displays domain menu itemsOffline tests
N/A - This change does not affect offline behavior. The
confirmReadyToOpenAppfunction resolves a Promise that gates API calls, and this behavior is unchanged.QA Steps
// [No QA] - This is a code refactoring with no user-visible changes. The functionality is identical before and after the change.
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
N/A - No UI changes (code refactoring only)
Android: mWeb Chrome
N/A - No UI changes (code refactoring only)
iOS: Native
N/A - No UI changes (code refactoring only)
iOS: mWeb Safari
N/A - No UI changes (code refactoring only)
MacOS: Chrome / Safari
N/A - No UI changes (code refactoring only)
Made with Cursor