Skip to content

[HOLD - for payment on July 14] Chat - Loading spinner appears after log in with different account #3838

Closed

Description

@kavimuru

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Lunch the app
  2. Log in with account A
  3. Send some messages and attachments
  4. Log out from Account A
  5. Log in with Account B

Expected Result:

Able to log in with Account B

Actual Result:

Loading spinner displayed when trying to log in with another account

Workaround:

Unknown

Platform:

Where is this issue occurring?

Web ✔️
iOS
Android ✔️
Desktop App
Mobile Web

Version Number:
1.0.75-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Bug5133999_Screen_Recording_20210630-092336_Expensifycash.mp4

Expensify/Expensify Issue URL:

View all open jobs on Upwork

Activity

  1. MelvinBot commented on Jun 30, 2021

    @MelvinBot
    Contributor

    Triggered auto assignment to @Beamanator (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  2. isagoico commented on Jun 30, 2021

    @isagoico

    This is not reproducible every time. I was able to reproduce 2 out of 5 times on my device.

  3. Beamanator commented on Jul 1, 2021

    @Beamanator
    Contributor

    Hmm when I follow the steps in the OP, I even get a blank white screen in web (staging), with this error message in the console:

    Screen Shot 2021-07-01 at 2 31 26 PM

  4. Beamanator commented on Jul 1, 2021

    @Beamanator
    Contributor

    Further investigation shows that the report draft comment becomes null in Onyx, and lodashGet only uses the default param ('') when the key is undefined.

    The below console logs came from this code that I added:

    console.log(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`)

    Screen Shot 2021-07-01 at 2 47 02 PM

  5. changed the title [-] Android - Chat - Loading spinner appears after log in with different account[/-] [+]Chat - Loading spinner appears after log in with different account[/+] on Jul 1, 2021
  6. Beamanator commented on Jul 1, 2021

    @Beamanator
    Contributor

    Updated title & OP to show this issue isn't specific to the Android platform

  7. Beamanator commented on Jul 1, 2021

    @Beamanator
    Contributor

    @isagoico I can reproduce this issue even in production web & it seems to be something that can be fixed externally so I'm going to make this external

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 1, 2021
  9. MelvinBot commented on Jul 1, 2021

    @MelvinBot
    Contributor

    Triggered auto assignment to @SofiedeVreese (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

  10. removed their assignment
    on Jul 1, 2021
  11. rdjuric commented on Jul 1, 2021

    @rdjuric
    Contributor

    Proposal

    We can modify our saveReportComment to avoid merging null draftComments to Onyx by checking if (comment === null) before doing the merge.

  12. 6 remaining items

  13. aliabbasmalik8 commented on Jul 2, 2021

    @aliabbasmalik8
    Contributor

    PROPOSAL:

    Need to add a validation check like this.

        const hasDraftComment = report
            && draftComments
            && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '')
            && lodashGet(draftComments, `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${report.reportID}`, '').length > 0;
    

    https://github.com/Expensify/Expensify.cash/blob/870c3db1675bb294c8961a8db88bc1ffa276dea9/src/libs/OptionsListUtils.js#L172-L174

    https://github.com/Expensify/Expensify.cash/blob/870c3db1675bb294c8961a8db88bc1ffa276dea9/src/libs/OptionsListUtils.js#L300-L302

    Thanks

  14. parasharrajat commented on Jul 2, 2021

    @parasharrajat
    Member

    This seems like a regression from my PR. Fix will be applied shortly. #3793

  15. parasharrajat commented on Jul 2, 2021

    @parasharrajat
    Member

    @Beamanator While fixing the regression does not solve this problem as I was already facing the same problem before I pushed the PR. But this time I found the root cause of it. This is little involved than it looks.

    Explanation

    1. We have a network Queue that process all the request for us. And out of all the requests, there are a few that don't require auth token but others need Auth token.

    2. Usually, the authentication request is the one that does not need auth token.

    3. When user login to the chat who has a long list of unread chat or let's say few IOU reports which is not yet synced. After login, we call APIs to sync this history. But if we immediately log out that user, there is a case where a few requests will continue to send and thus our queue will detect that and pause the Queue processing as the user is not logined.

    4. When we enter an email to the login form, we send a request to get the Account status to get some important information. Due to the queue is currently paused, this request will start looping and will never complete.

    5. As a result, the loader is shown on the button.

    Fix

    1. WE have to force send the request to Get_AccountStatus even if the queue is paused. for this, we just need to append a param in data forceNetworkRequest: true at https://github.com/Expensify/Expensify.cash/blob/bfc14ceddf75fa5eb024fdc2ce24430cd37c5d49/src/libs/actions/Session.js#L108.

    2. I tried to find all references to this request to make sure that we do not break the app. So as result, I found that this request is only used at the time of login when we have to get the account info. So this makes a good point to bypass the token check as we will never have the token on the Login page and this request does not need the token.

    This Fixes the original issue.

    Video explaining the issue in nutshell.

    loop-login.mp4
  16. chiragsalian commented on Jul 2, 2021

    @chiragsalian
    Contributor

    Yeah, your proposal LGTM @parasharrajat. Feel free to push out a PR and suggest the same proposal in upwork so that you can be paid for your work 👍

  17. SofiedeVreese commented on Jul 5, 2021

    @SofiedeVreese
    Contributor

    Ok I accepted your proposal in Upwork @parasharrajat !

  18. isagoico commented on Jul 5, 2021

    @isagoico

    Issue reproducible during KI retests.

  19. changed the title [-]Chat - Loading spinner appears after log in with different account[/-] [+][HOLD - for payment on July 14] Chat - Loading spinner appears after log in with different account[/+] on Jul 7, 2021
  20. SofiedeVreese commented on Jul 7, 2021

    @SofiedeVreese
    Contributor

    Payment scheduled for July 14.

  21. SofiedeVreese commented on Jul 14, 2021

    @SofiedeVreese
    Contributor

    @parasharrajat has been paid, the contract has been completed, and the Upwork post has been closed.

    Closing issue.

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

Metadata

Metadata

Labels

EngineeringExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions