Skip to content

Copilot - Not here page opens on central pane when switching account on Subscription tab #48246

Closed

Description

@IuliiaHerets

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.0.26-1
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Account has a subscription (activate by creating a workspace).
  1. Go to staging.new.expensify.com
  2. Log in as a copilot.
  3. Go to Account settings.
  4. Go to Subscription.
  5. Click Account switcher.
  6. Select another account.

Expected Result:

Not here page will not open on central pane.

Actual Result:

Not here page opens on central pane when switching account on Subscription page.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6585878_1724884609221.20240829_063331.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @rushatgabhane

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 29, 2024
  2. melvin-bot commented on Aug 29, 2024

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (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.

  3. bernhardoj commented on Aug 29, 2024

    @bernhardoj
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Subscription page shows not found when switching account.

    What is the root cause of that problem?

    When we switch account, we clear the onyx and calls open app.

    .then(() => Onyx.clear(KEYS_TO_PRESERVE_DELEGATE_ACCESS))
    .then(() => {
    // Update authToken in Onyx and in our local variables so that API requests will use the new authToken
    updateSessionAuthTokens(response?.restrictedToken, response?.encryptedAuthToken);
    NetworkStore.setAuthToken(response?.restrictedToken ?? null);
    confirmReadyToOpenApp();
    openApp();
    });

    Because the data is cleared, the subscription data is gone and thus not found page is shown.

    if (!subscriptionPlan) {
    return <NotFoundPage />;
    }

    What changes do you think we should make in order to solve the problem?

    We can show a loading indicator while the app is still loading.

    if (!subscriptionPlan) {
        if (isLoadingApp) {
            return <FullScreenLoadingIndicator />
        }
        return <NotFoundPage />;
    }
    

    But this isn't enough because clearing the onyx happened first before the open app request, so not found will still show briefly.

    We can optimistically set the IS_LOADING_APP when switching the account (connect & disconnect) knowing that we will call open app (set it to false when fails),

    function connect(email: string) {
    if (!delegatedAccess?.delegators) {
    return;
    }
    const optimisticData: OnyxUpdate[] = [
    {
    onyxMethod: Onyx.METHOD.MERGE,
    key: ONYXKEYS.ACCOUNT,
    value: {
    delegatedAccess: {
    delegators: delegatedAccess.delegators.map((delegator) => (delegator.email === email ? {...delegator, error: undefined} : delegator)),
    },
    },
    },
    ];

    and also we need to preserve the key so it won't be cleared.

    const KEYS_TO_PRESERVE_DELEGATE_ACCESS = [ONYXKEYS.NVP_TRY_FOCUS_MODE, ONYXKEYS.PREFERRED_THEME, ONYXKEYS.NVP_PREFERRED_LOCALE, ONYXKEYS.SESSION];

    Or, we can introduce a new onyx key called IS_SWITCHING_ACCOUNT.
    Or, we can just add it as a new property to ACCOUNT

    account.isSwitching
    
  4. added
    DeployBlockerCashThis issue or pull request should block deployment
    and removed on Aug 29, 2024
  5. melvin-bot commented on Aug 29, 2024

    @melvin-bot

    Triggered auto assignment to @cristipaval (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  6. github-actions commented on Aug 29, 2024

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  7. IuliiaHerets commented on Aug 29, 2024

    @IuliiaHerets
    Author

    Sorry, forgot to add DeployBlockerCash label

  8. cristipaval commented on Aug 29, 2024

    @cristipaval
    Contributor

    This isn't a blocker, given that the Not found page shows briefly for a second only. Demoting

  9. 17 remaining items

  10. mallenexpensify commented on Sep 3, 2024

    @mallenexpensify
    Contributor

    Checking on here, looks like it's part of control

    https://expensify.slack.com/archives/C06ML6X0W9L/p1725317232367829

  11. melvin-bot commented on Sep 6, 2024

    @melvin-bot

    @dangrous, @mallenexpensify, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

  12. mallenexpensify commented on Sep 7, 2024

    @mallenexpensify
    Contributor

    Made you issue owner @rushatgabhane , I think next action is either on you or will be. Comment if you disagree

  13. dangrous commented on Sep 24, 2024

    @dangrous
    Contributor

    This went to prod 9/19 - I believe we can close 9/26 - and no payment required I believe

  14. dangrous commented on Sep 30, 2024

    @dangrous
    Contributor

    Closing this, @allgandalf I believe your review for the PR is being handled on another issue, but if that's NOT the case, please ping here and I can reopen/assign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions