Skip to content

[Payment May 22] [$250] Dev: Sign out option is shown and signout API is called in the crash error message screen even when the user is not signed in. #61336

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

Open
4 of 16 tasks
m-natarajan opened this issue May 2, 2025 · 13 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause Reviewing Has a PR in review Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented May 2, 2025

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:
Reproducible in staging?: Needs Reproduction
Reproducible in production?: Needs Reproduction
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @allgandalf
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

Precondition: The user is signed out
The app needs to crash when you're on the sign-in page ( due to onyx null / empty string values)

Expected Result:

There should be no sign out button as the user is not logged in.

Actual Result:

There is a sign out button and the API to signout gets called everytime we click sign out.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Screen.Recording.2025-05-02.at.11.06.59.AM.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021920085359499306735
  • Upwork Job ID: 1920085359499306735
  • Last Price Increase: 2025-05-07
  • Automatic offers:
    • allgandalf | Reviewer | 107231790
Issue OwnerCurrent Issue Owner: @chiragsalian
@m-natarajan m-natarajan added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Needs Reproduction Reproducible steps needed retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause labels May 2, 2025
Copy link

melvin-bot bot commented May 2, 2025

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

@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@m-natarajan
Copy link
Author

Proposal by @allgandalf

Proposal

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

Signout option is shown on the generic error page even when the user is not signed in.

What is the root cause of that problem?

We shown the sign out option regardless of checking whether the user is signed in or not:

<Button
text={translate('initialSettingsPage.signOut')}
onPress={() => {
Session.signOutAndRedirectToSignIn();
refreshPage();
}}
/>

This causes us to always show the button.

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

We need to check if the session has authToken then only display the button:

const isSignedIn = !!session?.authToken && session?.authTokenType !== CONST.AUTH_TOKEN_TYPES.ANONYMOUS;

{isSignedIn && (

<Button
    text={translate('initialSettingsPage.signOut')}
    onPress={() => {
     Session.signOutAndRedirectToSignIn();
      refreshPage();
     }}
                  />
)}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A, but if we need we can render the screen and check the button is not visible if the user is not logged in

What alternative solutions did you explore? (Optional)

N/A

@shubham1206agra
Copy link
Contributor

I don't think this requires Needs Repro label.

@melvin-bot melvin-bot bot added the Overdue label May 5, 2025
Copy link

melvin-bot bot commented May 6, 2025

@abekkala Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@abekkala abekkala added the External Added to denote the issue can be worked on by a contributor label May 7, 2025
@melvin-bot melvin-bot bot changed the title Dev: Sign out option is shown and signout API is called in the crash error message screen even when the user is not signed in. [$250] Dev: Sign out option is shown and signout API is called in the crash error message screen even when the user is not signed in. May 7, 2025
Copy link

melvin-bot bot commented May 7, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 7, 2025
Copy link

melvin-bot bot commented May 7, 2025

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

@melvin-bot melvin-bot bot removed the Overdue label May 7, 2025
@abekkala abekkala removed the Needs Reproduction Reproducible steps needed label May 7, 2025
@shubham1206agra
Copy link
Contributor

shubham1206agra commented May 7, 2025

Proposal

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

Sign out option is shown and signout API is called in the crash error message screen even when the user is not signed in.

What is the root cause of that problem?

We shown the sign out option regardless of checking whether the user is signed in or not:

<Button
text={translate('initialSettingsPage.signOut')}
onPress={() => {
Session.signOutAndRedirectToSignIn();
refreshPage();
}}
/>

This causes us to always show the button.

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

We need to check if the session is authenticated then only display the button:

const isAuthenticated = useIsAuthenticated();

{isAuthenticated && (
    <Button
        text={translate('initialSettingsPage.signOut')}
        onPress={() => {
            Session.signOutAndRedirectToSignIn();
            refreshPage();
        }}
    />
)}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A

What alternative solutions did you explore? (Optional)

N/A

@allgandalf
Copy link
Contributor

Let's go with @shubham1206agra 's proposal here ^

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented May 7, 2025

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

@chiragsalian
Copy link
Contributor

Proposal LGTM, feel free to create the PR @shubham1206agra

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 8, 2025
Copy link

melvin-bot bot commented May 8, 2025

📣 @allgandalf 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels May 11, 2025
@abekkala
Copy link
Contributor

Merged to prod yesterday

@abekkala abekkala changed the title [$250] Dev: Sign out option is shown and signout API is called in the crash error message screen even when the user is not signed in. [Payment May 22] [$250] Dev: Sign out option is shown and signout API is called in the crash error message screen even when the user is not signed in. May 16, 2025
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. External Added to denote the issue can be worked on by a contributor retest-weekly Apply this label if you want this issue tested on a Weekly basis by Applause Reviewing Has a PR in review Weekly KSv2
Projects
Status: No status
Development

No branches or pull requests

6 participants