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

[$250] Sign in - Account settings long loading if navigate via public room link & login as new account #48715

Open
1 of 6 tasks
lanitochka17 opened this issue Sep 6, 2024 · 28 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Hot Pick Ready for an engineer to pick up and run with

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 6, 2024

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: 9.0.30-9
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): ponikarchuks+106924@gmail.com
Issue reported by: Applause - Internal Team

Issue found when executing PR #48144

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Log out
  3. Go to this link https://staging.new.expensify.com/r/7075912447943023
  4. Tap sign in
  5. Enter credentials and log in as a new Gmail account

Expected Result:

Account settings loads fine

Actual Result:

Account settings long loading

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence

Bug6595301_1725625415082.A_clear_anonymous_user_records_after_login.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021836652520479378795
  • Upwork Job ID: 1836652520479378795
  • Last Price Increase: 2024-09-26
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 6, 2024
Copy link

melvin-bot bot commented Sep 6, 2024

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

@lanitochka17
Copy link
Author

@bfitzexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@bfitzexpensify
Copy link
Contributor

Checking in on the other issue here

@bfitzexpensify
Copy link
Contributor

I am heading out of office until September 21st, so assigning a buddy to watch over this in my absence.

Current status: confirming if the other PR caused this

@bfitzexpensify bfitzexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Sep 6, 2024
Copy link

melvin-bot bot commented Sep 6, 2024

Current assignee @bfitzexpensify is eligible for the Bug assigner, not assigning anyone new.

@bfitzexpensify bfitzexpensify removed their assignment Sep 6, 2024
@bfitzexpensify bfitzexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Sep 6, 2024
Copy link

melvin-bot bot commented Sep 6, 2024

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

@bfitzexpensify bfitzexpensify self-assigned this Sep 6, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 9, 2024
@jjcoffee
Copy link
Contributor

jjcoffee commented Sep 9, 2024

This doesn't appear to be related to #47806 - I can repro with the changes from there reverted. It's probably a BE issue as there are no personalDetails returned in the SignUpUser call.

Copy link

melvin-bot bot commented Sep 9, 2024

@bfitzexpensify, @VictoriaExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@VictoriaExpensify
Copy link
Contributor

Thanks for confirming @jjcoffee . I'm going to move this to internal since this sounds like a BE issue

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2024
@VictoriaExpensify VictoriaExpensify added Internal Requires API changes or must be handled by Expensify staff Hot Pick Ready for an engineer to pick up and run with labels Sep 11, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 13, 2024
@VictoriaExpensify
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Sep 16, 2024
@trjExpensify
Copy link
Contributor

Is this bug specific to the public rooms flow and on Android native only? If so, that was a project in #vip-vsb, and I think @jasperhuangg might be good to offer insight into that.

@melvin-bot melvin-bot bot added the Overdue label Sep 18, 2024
@jasperhuangg
Copy link
Contributor

jasperhuangg commented Sep 19, 2024

@jjcoffee The SignUpUser command isn't in charge of returning personal details, ReconnectApp/OpenApp is.

cc @marcochavezf IIRC you implemented this flow, it seems like we're not calling ReconnectApp when the user is signed in from the public room, which I think could be preventing us from loading their personal details.

Screenshot 2024-09-19 at 2 18 21 PM

Under normal circumstances when we sign up a new user we do call it:
Screenshot 2024-09-19 at 2 21 36 PM

So I believe this issue lies in the front-end and can be worked on externally, I think we just need to figure out why we're not calling ReconnectApp for that particular flow.

@jasperhuangg jasperhuangg added External Added to denote the issue can be worked on by a contributor and removed Internal Requires API changes or must be handled by Expensify staff labels Sep 19, 2024
@melvin-bot melvin-bot bot changed the title Sign in - Account settings long loading if navigate via public room link & login as new account [$250] Sign in - Account settings long loading if navigate via public room link & login as new account Sep 19, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021836652520479378795

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 19, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External)

@melvin-bot melvin-bot bot removed the Overdue label Sep 19, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

@bfitzexpensify @VictoriaExpensify @thesahindia this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@VictoriaExpensify
Copy link
Contributor

@marcochavezf - have you got any insights to add to @jasperhuangg comment here?

@melvin-bot melvin-bot bot added the Overdue label Sep 24, 2024
@VictoriaExpensify
Copy link
Contributor

Not overdue

@bfitzexpensify
Copy link
Contributor

I'm back from OOO and can take this back over - thanks for looking after it @VictoriaExpensify!

@melvin-bot melvin-bot bot removed the Overdue label Sep 24, 2024
@wildan-m
Copy link
Contributor

Proposal

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

Slow loading times when accessing through a public room link and logging in as a new account.

What is the root cause of that problem?

A deadlock occurs when executing OpenApp while OpenReport is triggered.

Clicking the Join button triggers the openReport first.

useEffect(() => {
const wasLoginChangedDetected = prevAuthTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS && !session?.authTokenType;
if (wasLoginChangedDetected && didUserLogInDuringSession() && isUserCreatedPolicyRoom(report)) {
openReportIfNecessary();
}
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [session, report]);

Then openApp

if (!isAnonymousUser) {
// Signing in RHP is only for anonymous users
Navigation.isNavigationReady().then(() => Navigation.dismissModal());
App.openApp();
}

During openReport processing, communication gaps between client and server may cause the queue to pause.

if (response?.shouldPauseQueue) {
Log.info("[SequentialQueue] Handled 'shouldPauseQueue' in response. Pausing the queue.");
pause();
}

When that occurs, we are unable to process or clear the queue.

image

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

I think openApp should be the first request to call before everything else, since that API is responsible to make isLoadingApp to false.

Clear any persisted request in signInModal before calling openApp.

src/pages/signin/SignInModal.tsx

import * as PersistedRequests from '@libs/actions/PersistedRequests';

    useEffect(() => {
        const isAnonymousUser = session?.authTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS;
        if (!isAnonymousUser) {
            // Signing in RHP is only for anonymous users
            Navigation.isNavigationReady().then(() => Navigation.dismissModal());
            PersistedRequests.clear();
            App.openApp();
        }
    }, [session?.authTokenType]);

What alternative solutions did you explore? (Optional)

If we don't want to clear any pending requests, we can wait for the openApp function until the queue is idle.

src/pages/signin/SignInModal.tsx

import { waitForIdle } from '@libs/Network/SequentialQueue';

    useEffect(() => {
        const isAnonymousUser = session?.authTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS;
        if (!isAnonymousUser) {
            // Signing in RHP is only for anonymous users
            Navigation.isNavigationReady().then(() => Navigation.dismissModal());
            waitForIdle().then(() => {
                App.openApp();
            })
        }
    }, [session?.authTokenType]);

Copy link

melvin-bot bot commented Sep 26, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Sep 26, 2024
@VictoriaExpensify VictoriaExpensify removed their assignment Sep 26, 2024
@melvin-bot melvin-bot bot removed the Overdue label Sep 26, 2024
@thesahindia
Copy link
Member

@wildan-m's proposal looks good to me!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Sep 27, 2024

Triggered auto assignment to @lakchote, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot added the Overdue label Sep 30, 2024
@lakchote
Copy link
Contributor

@wildan-m could you please post a video doing the same reproduction steps with your fix?

It seems like your solution is different from what was imagined by @jasperhuangg with ReconnectApp.

@melvin-bot melvin-bot bot removed the Overdue label Sep 30, 2024
@wildan-m
Copy link
Contributor

If openApp gets stuck, the following queue, including reconnectApp, will also get stuck.

@lakchote
Copy link
Contributor

If openApp gets stuck, the following queue, including reconnectApp, will also get stuck.

I'd still like to see the same reproduction steps with your fix, to see it in action.

cc @aldo-expensify was there a particular reason you wanted to trigger OpenReport first? To make sure we're not introducing unwanted side effects if we change the order of the API calls.

useEffect(() => {
const wasLoginChangedDetected = prevAuthTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS && !session?.authTokenType;
if (wasLoginChangedDetected && didUserLogInDuringSession() && isUserCreatedPolicyRoom(report)) {
openReportIfNecessary();
}
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [session, report]);

@wildan-m
Copy link
Contributor

@lakchote My main solution used to work well, but now it's not functioning properly. The new user is not automatically joining, possibly due to recent changes.

My alternative solution still working properly, force redirection to concierge seems expected for a new user(?)

Kapture.2024-09-30.at.16.20.15.mp4

@lakchote
Copy link
Contributor

@wildan-m thanks for checking it again.

My alternative solution still working properly, force redirection to concierge seems expected for a new user(?)

That seems valid to me too as it'll introduce the user to the platform. What do you think @trjExpensify?

@trjExpensify
Copy link
Contributor

That seems valid to me too as it'll introduce the user to the platform. What do you think @trjExpensify?

Hm, I'm not sure. I don't think I agree with that. If you signed up from a public room, you would expect to drop back into the public room to continue what you were doing (like now being able to comment).

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Hot Pick Ready for an engineer to pick up and run with
Projects
Status: No status
Development

No branches or pull requests

9 participants