Fix back button loop on Profile after copiloting into an agent - #100686
Open
yusufdeveloper2903 wants to merge 1 commit into
Open
Fix back button loop on Profile after copiloting into an agent#100686yusufdeveloper2903 wants to merge 1 commit into
yusufdeveloper2903 wants to merge 1 commit into
Conversation
melvin-bot
Bot
requested review from
eVoloshchak and
trjExpensify
and removed request for
a team
September 9, 2026 08:10
|
@eVoloshchak 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] |
trjExpensify
approved these changes
Sep 9, 2026
trjExpensify
left a comment
Contributor
There was a problem hiding this comment.
simple navigation fix 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
Copiloting into an agent from the agent chat header leaves 4 root stack entries, two of which hold owner-only screens guarded by
withAgentAccessDenied. The redirect to Profile only dismissed the topmost modal, and because it started from the Reports tablinkTo's cross-tab rule turned the REPLACE back into a PUSH, discardingforceReplace. So the stale guarded routes survived underneath, and pressing back re-focused one, which firedredirectAgentAwayand pushed Profile again — the loop.Calling
Navigation.popRootToTop()before the redirect drops every root entry created during the owner's session, so nothing guarded is left to re-fire andforceReplacecan finally replace the guarded pane: root entries go 4 → 1, the split under Profile becomes[Settings_Root, Settings_Profile], and back lands on the Account page instead ofHome.dismissModalis kept so the RHP still animates away, andlinkTois untouched. Addedtests/navigation/AgentCopilotRedirectTests.tsx, which fails onmainwithExpected: 1, Received: 4.Fixed Issues
$ #99074
PROPOSAL: #99074 (comment)
Tests
Precondition: an account with an agent created under Account > Agents.
Offline tests
Copiloting is blocked while offline (
useSwitchToDelegatorshort-circuits when the network is offline), so this flow cannot be started offline and the change has no offline-specific behavior.QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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.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
Before fix:
REC-20260909124538.mp4
After fix Native:
REC-20260909124657.mp4
Android: mWeb Chrome
REC-20260909130201.mp4
iOS: Native
After fix:
REC-20260909125401.mp4
iOS: mWeb Safari
After fix:
REC-20260909125617.mp4
MacOS: Chrome / Safari