Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 6 tasks
IuliiaHerets opened this issue Aug 29, 2024 · 19 comments
Closed
2 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Aug 29, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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): [email protected]
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
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 29, 2024
Copy link

melvin-bot bot commented Aug 29, 2024

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.

@bernhardoj
Copy link
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

@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment and removed Daily KSv2 labels Aug 29, 2024
Copy link

melvin-bot bot commented Aug 29, 2024

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

Copy link
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.

@IuliiaHerets
Copy link
Author

Sorry, forgot to add DeployBlockerCash label

@cristipaval
Copy link
Contributor

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

@cristipaval cristipaval added Daily KSv2 Hourly KSv2 and removed Hourly KSv2 DeployBlockerCash This issue or pull request should block deployment Daily KSv2 labels Aug 29, 2024
@cristipaval
Copy link
Contributor

@dangrous, I think you have knowledge of Copilot in NewDot? Would you mind taking over this one?

@cristipaval cristipaval added Daily KSv2 and removed Hourly KSv2 labels Aug 29, 2024
@dangrous
Copy link
Contributor

yeah sure!

@dangrous dangrous assigned dangrous and unassigned cristipaval Aug 29, 2024
@dangrous
Copy link
Contributor

I think the IS_LOADING_APP idea makes sense here, but we'll also want to consider this same situation in other places in the app. Is there a holistic solution we can use here? Also @rushatgabhane we'll probably want to take this on ourselves?

@cristipaval
Copy link
Contributor

Thanks a lot @dangrous! 🙇

@mallenexpensify
Copy link
Contributor

@rushatgabhane can you provide feedback here so we can decide on the next steps?

@rushatgabhane
Copy link
Member

hmmm

if the last visited page is subscription, and you login you'll get the same bug.

I'll see how we should fix this in the mega fix

@mallenexpensify
Copy link
Contributor

Assigned to you @rushatgabhane , while we figure out what the next best steps are here.
What project is Copilot part of, didn't see anything on Expensify Road Map Projects - Public

@rushatgabhane
Copy link
Member

Wave control??

@mallenexpensify
Copy link
Contributor

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

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

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@rushatgabhane rushatgabhane mentioned this issue Sep 4, 2024
50 tasks
@melvin-bot melvin-bot bot added the Overdue label Sep 5, 2024
Copy link

melvin-bot bot commented Sep 6, 2024

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

@mallenexpensify
Copy link
Contributor

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

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Sep 8, 2024
@dangrous
Copy link
Contributor

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

@dangrous
Copy link
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
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Reviewing Has a PR in review Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests

6 participants