Repository navigation
[$250] mWeb - Concierge chat appears twice after logging in via Concierge deeplink #60859
Description
Activity
- addedBugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2
on Apr 24, 2025 Triggered auto assignment to @maddylewis (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.Proposal
Please re-state the problem that we are trying to solve in this issue.
- When a user logs in with an existing account via https://staging.new.expensify.com/concierge, the Concierge chat appears twice. This issue occurs on both Android and iOS mobile web (mWeb).
What is the root cause of that problem?
- This callback function is being invoked twice after login. Consequently, the navigation action is also triggered twice, resulting in the Concierge chat opening twice when logging in through the Concierge deeplink.
What changes do you think we should make in order to solve the problem?
- After the line where the callback is set (link), we should call:
Onyx.disconnect(connection);This will unsubscribe from the Onyx connection, ensuring the callback is not triggered more than once.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
- None.
What alternative solutions did you explore? (Optional)
- An alternative approach would be to implement a guard flag to ensure navigation only happens once. For example:
App/src/libs/actions/Report.ts
Line 3326 in 698ce03
Navigation.navigate(route as Route);
if (!isNavigationTriggered) { Navigation.navigate(route as Route); isNavigationTriggered = true; }- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributor
on Apr 24, 2025 - changed the title
[-]mWeb - Concierge chat appears twice after logging in via Concierge deeplink[/-][+][$250] mWeb - Concierge chat appears twice after logging in via Concierge deeplink[/+]on Apr 24, 2025 Job added to Upwork: https://www.upwork.com/jobs/~021915505151324649989
- addedHelp WantedApply this label when an issue is open to proposals by contributorsApply this label when an issue is open to proposals by contributors
on Apr 24, 2025 Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (
External)Proposal
Please re-state the problem that we are trying to solve in this issue.
Concierge chat is opened twice when deeplink to it while logged out.
What is the root cause of that problem?
The deeplink while logged out is handled here.
App/src/libs/actions/Report.ts
Lines 3273 to 3342 in 2d3950e
InteractionManager.runAfterInteractions(() => { waitForUserSignIn().then(() => { const connection = Onyx.connect({ key: ONYXKEYS.NVP_ONBOARDING, callback: () => { Navigation.waitForProtectedRoutes().then(() => { if (route && isAnonymousUser() && !canAnonymousUserAccessRoute(route)) { signOutAndRedirectToSignIn(true); return; } // We don't want to navigate to the exitTo route when creating a new workspace from a deep link, // because we already handle creating the optimistic policy and navigating to it in App.setUpPoliciesAndNavigate, // which is already called when AuthScreens mounts. if (url && new URL(url).searchParams.get('exitTo') === ROUTES.WORKSPACE_NEW) { return; } const handleDeeplinkNavigation = () => { // We want to disconnect the connection so it won't trigger the deeplink again // every time the data is changed, for example, when relogin. Onyx.disconnect(connection); const state = navigationRef.getRootState(); const currentFocusedRoute = findFocusedRoute(state); if (isOnboardingFlowName(currentFocusedRoute?.name)) { setOnboardingErrorMessage(Localize.translateLocal('onboarding.purpose.errorBackButton')); return; } if (shouldSkipDeepLinkNavigation(route)) { return; } if (isAuthenticated) { return; } // Check if the report exists in the collection const report = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; // If the report does not exist, navigate to the last accessed report or Concierge chat if (reportID && !report) { const lastAccessedReportID = findLastAccessedReport(false, shouldOpenOnAdminRoom(), undefined, reportID)?.reportID; if (lastAccessedReportID) { const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID); Navigation.navigate(lastAccessedReportRoute); return; } navigateToConciergeChat(false, () => true); return; } Navigation.navigate(route as Route); }; if (isAnonymousUser()) { handleDeeplinkNavigation(); return; } // We need skip deeplinking if the user hasn't completed the guided setup flow. isOnboardingFlowCompleted({ onNotCompleted: () => startOnboardingFlow(), onCompleted: handleDeeplinkNavigation, onCanceled: handleDeeplinkNavigation, }); }); }, }); }); It will wait until the user is logged in and then connect to the onboarding onyx data. When logged in, the data is initially undefined, and then changed to the onboarding data. Because of this, the onyx callback is called twice, leading to two navigation.
We connect to the onboarding data to prevent the deeplink if the user needs to complete the onboarding first, implemented in #44536. But now, we don't use the onboarding data anymore, instead, we use the
isOnboardingFlowCompleted.
App/src/libs/actions/Report.ts
Lines 3333 to 3338 in 2d3950e
// We need skip deeplinking if the user hasn't completed the guided setup flow. isOnboardingFlowCompleted({ onNotCompleted: () => startOnboardingFlow(), onCompleted: handleDeeplinkNavigation, onCanceled: handleDeeplinkNavigation, }); What changes do you think we should make in order to solve the problem?
Remove the onyx connect. But, this will now totally prevent a new user to deep link. I know that #44536 prevents it, but #49092 "changes" it, so that after completing the onboarding, the user is navigated to the deeplink. This is possible because we will only disconnect the onyx callback after the navigation is done.
If we want to prevent it back, then remove the onyx connect. Else, we can keep the onyx connect, but return early if the onboarding data is empty.
const connection = Onyx.connect({ key: ONYXKEYS.NVP_ONBOARDING, callback: (val) => { if (!val) { return; }What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N/A
Reviewing proposals
@eh2077 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
18 remaining items
BugZero Checklist:
- [Contributor] Classify the bug:
Bug classification
Source of bug:
- 1a. Result of the original design (eg. a case wasn't considered)
- 1b. Mistake during implementation
- 1c. Backend bug
- 1z. Other:
Where bug was reported:
- 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
- 2b. Reported on staging (eg. found during regression or PR testing)
- 2d. Reported on a PR
- 2z. Other:
Who reported the bug:
- 3a. Expensify user
- 3b. Expensify employee
- 3c. Contributor
- 3d. QA
- 3z. Other:
-
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: https://github.com/Expensify/App/pull/49092/files#r2158052495
-
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
-
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
-
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
- NA
Test:
- Log out
- Open /concierge (staging.new.expensify.com/concierge) and then login
- After the concierge chat opens, press the header back button (not applicable to web and desktop)
- Verify you arrived at the LHN
Do we agree 👍 or 👎
Requested in ND.
@maddylewis Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@maddylewis Eep! 4 days overdue now. Issues have feelings too...
@maddylewis Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
@maddylewis 10 days overdue. I'm getting more depressed than Marvin.
$250 approved for @bernhardoj
@maddylewis 12 days overdue now... This issue's end is nigh!
This issue has not been updated in over 14 days. @AndrewGable, @maddylewis, @bernhardoj, @eh2077 eroding to Weekly issue.
$250 approved for @eh2077
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.1.32-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5989784
Email or phone of affected tester (no customers): n.a
Issue reported by: Applause Internal Team
Device used: iphone promax 13, IOS 18.3.2
App Component: Other
Action Performed:
Steps:
Expected Result:
When a user logs in with an existing account via the Concierge link, the Concierge chat appears only once.
Actual Result:
When user logged in with existing account via https://staging.new.expensify.com/concierge, the Concierge chat appear twice. Issue occured on both mweb Android and iOS
Workaround:
Unknown
Platforms:
Screenshots/Videos
1.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @maddylewis