Add fallback routes to Copy Policy Settings navigation and clear features on workspace change - #93546
Conversation
After a page refresh, the navigation state is reconstructed from the URL alone, missing intermediate screens. This adds a fallback route to Navigation.goBack() so back navigation works correctly even after refresh. Fixes part of Expensify#91792
Similar to SELECT_FEATURES, the CONFIRM page back button now navigates to SELECT_FEATURES with a fallback route, ensuring correct navigation after page refresh. Fixes part of Expensify#91792
When navigating from Confirm page to edit workspaces, if the user changes their workspace selection, the previously selected features are cleared. This prevents stale/incompatible feature selections when target workspaces change. Fixes Expensify#92385
Add unit tests covering: - Back button route construction for SELECT_FEATURES and CONFIRM pages - Route construction verification for all Copy Policy Settings routes - Workspace selection change detection logic
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@shubham1206agra 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a2ebee324
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
When workspace selection changes and parts are cleared, the Confirm page could end up in a broken state with workspaces selected but no features. Now it redirects to SELECT_FEATURES page when parts is empty but targetPolicyIDs exists, allowing the user to re-select features.
Replace manual `as jest.MockedFunction<typeof fn>` casts with the type-safe `jest.mocked()` helper to resolve ESLint no-unsafe-type-assertion warnings.
Update the Onyx type definition to use Part[] instead of string[] for the parts field, eliminating the need for unsafe type assertions in consuming components.
- Remove redundant `as Part[]` cast in CopyPolicySettingsSelectFeaturesPage since the Onyx type now uses Part[] directly - Add explicit assertions in navigation tests to fail clearly when workspace items aren't found
Screen.Recording.2026-06-17.at.5.08.12.PM.mov@fedirjh BUG: Double naviagtion on feature selection page |
Wait for Onyx.merge to complete before navigating, and ensure ConfirmPage checks that data is loaded before making redirect decisions.
| const hasLoadedCopyPolicySettings = copyPolicySettingsState !== undefined; | ||
| const hasLoadedPolicies = policies !== undefined; | ||
| const parts = copyPolicySettingsState?.parts ?? []; | ||
| const isDataLoaded = policiesMetadata.status === 'loaded' && copyPolicySettingsMetadata.status === 'loaded'; |
There was a problem hiding this comment.
Use isLoadingOnyxValue function here
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-06-17.at.6.29.35.PM.mov |
…s-navigation-91792
…g pendingAction to null
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @yuwenmemon 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.10-0 🚀
Bundle Size Analysis (Sentry): |
Help site review: no docs changes requiredI reviewed the changes in this PR against the help-site articles under Conclusion: No help site updates are needed. Why: This PR is a navigation bug fix for the Copy Policy Settings flow. The changes:
None of these change any user-facing feature names, menu items, button labels, or the documented end-to-end flow. The closest help article — Duplicate Workspace ( Since no documentation changes are required, I did not create a draft help site PR. @fedirjh, please confirm you agree no help site changes are needed. If you'd like a docs PR created for any behavior here, let me know and I'll open one. |
|
Deploy Blocker #93879 was identified to be related to this PR. |
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.12-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 No help site changes required. I reviewed this PR against the relevant help article ( Why: This PR is a navigation/state bug fix only:
The diff touches action/page/type/test files and no Since there's no documented behavior change, I'm not opening a draft docs PR. @fedirjh, if you'd like a docs update anyway (e.g., to document the multi-step copy flow in more detail), let me know and I'll draft one. |
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.14-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.14-1 🚀
|
Explanation of Change
This PR fixes incorrect navigation behavior in the Copy Policy Settings flow after page refresh.
Fixed Issues
$ #91792
$ #92385
Tests
Prerequisite: Account has at least two workspaces.
Test 1: Back navigation from SELECT_FEATURES after refresh
Test 2: Back navigation from CONFIRM after refresh
Test 3: Normal navigation without a refresh
Test 4: Selected features are cleared when selected workspaces changes
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))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
CleanShot.2026-06-14.at.14.59.43.mp4
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari