Skip to content

[HOLD for payment 2023-11-29] [$500] Status - Different chat report opens when clicking on the back button in Status modal #30509

Closed

Description

@izarutskaya

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: v1.3.92-0
Reproducible in staging?: Y
Reproducible in production?: Y
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: Applause-Internal Team
Slack conversation: @

Action Performed:

Precondition: User has set a status.

  1. Go to staging.new.expensify.com
  2. Open different chat reports.
  3. Click on the status on the top left.
  4. Click on the back button.

Expected Result:

The current chat report remains open.

Actual Result:

A different chat report opens.

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Bug6253028_1698396389798.20231027_164311.mp4
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f903eb3ac10fe198
  • Upwork Job ID: 1717888354588504064
  • Last Price Increase: 2023-10-27
  • Automatic offers:
    • shubham1206agra | Reviewer | 27537929
    • dukenv0307 | Contributor | 27537933

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 27, 2023
  2. changed the title [-]Status - Different chat report opens when clicking on the back button in Status modal[/-] [+][$500] Status - Different chat report opens when clicking on the back button in Status modal[/+] on Oct 27, 2023
  3. melvin-bot commented on Oct 27, 2023

    @melvin-bot
  4. melvin-bot commented on Oct 27, 2023

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 27, 2023
  6. melvin-bot commented on Oct 27, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  7. melvin-bot commented on Oct 27, 2023

    @melvin-bot

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

  8. namhihi237 commented on Oct 27, 2023

    @namhihi237
    Contributor

    Proposal

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

    Different chat report opens when clicking on the back button in Status modal

    What is the root cause of that problem?

    In the StatusPage we pass navigateBackToSettingsPage into onBackButtonPress prop.
    In navigateBackToSettingsPage we pass the param shouldPopToTop = true here

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

    I think we can remove the shouldPopToTop param

            Navigation.goBack(ROUTES.SETTINGS_PROFILE, false)

    What alternative solutions did you explore? (Optional)

    N/A

  9. dummy-1111 commented on Oct 27, 2023

    @dummy-1111
    Contributor

    Proposal

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

    When go to status page after navigating several reports, back button navigates to the report other than the current report

    What is the root cause of that problem?

    When we navigate to status page, we set shouldPopAllStateOnUP to true and go to the page

    Navigation.setShouldPopAllStateOnUP();

    And when we go back, we call navigate.goBack with shouldPopToTop = true
    const navigateBackToSettingsPage = useCallback(() => Navigation.goBack(ROUTES.SETTINGS_PROFILE, false, true), []);

    This makes the route stack pop to the first page, which is home page.

    if (shouldPopToTop) {
    if (shouldPopAllStateOnUP) {
    shouldPopAllStateOnUP = false;
    navigationRef.current.dispatch(StackActions.popToTop());
    return;
    }
    }

    For wide screen devices, we navigate to the last accessed report when navigating to home page

    const reportID = getLastAccessedReportID(reports, !canUseDefaultRooms, policies, isFirstTimeNewExpensifyUser, lodashGet(route, 'params.openOnAdminRoom', false));

    We determine the last access report by its lastReadTime.

    let sortedReports = sortReportsByLastRead(reports);

    The problem is here. When we call OpenReport API, lastReadTime isn't updated
    image

    This is the root cause

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

    I think this issue should be fixed in the backend.
    OpenReport call should return the updated lastReadTime

    What alternative solutions did you explore? (Optional)

    We can simply call Navigation.goBack(ROUTES.SETTINGS_PROFILE), that is, call goBack with shouldPopToTop = false

  10. dukenv0307 commented on Oct 28, 2023

    @dukenv0307
    Contributor

    Proposal

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

    A different chat report opens when clicking back button in status modal.

    What is the root cause of that problem?

    We're setting shouldPopToTop: true when going back from the status page here. We're also calling setShouldPopAllStateOnUP here in the Avatar status.

    This is so that:

    • If the user navigates to the StatusPage from the Avatar status, they should go back to the LHN (or the last report in the background, in case of wide screen)
    • If the user navigates to the StatusPage via deep link (not going through the Avatar status), they should go back to the Profile settings page normally (because in this case setShouldPopAllStateOnUP is not set)

    But this causes a side effect, which is this issue, where we go back to a different report, because the report that was open when avatar status is clicked might not be the last read report of the LHN.

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

    We just need to add a condition, if there's a report open in the background of the status page (in that case there exists a topmost report id), we should go back to that report instead. We can update this to

    const topmostReportId = Navigation.getTopmostReportId();
    const navigateBackToSettingsPage = useCallback(() => {
            if (topmostReportId) {
                Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(topmostReportId))
            } else {
                Navigation.goBack(ROUTES.SETTINGS_PROFILE, false, true);
            }
        }
    , [topmostReportId]);
    

    This will keep our intended behavior for using shouldPopToTop, while fixing the side effect that causes this issue.

    What alternative solutions did you explore? (Optional)

    NA

  11. 25 remaining items

  12. changed the title [-][$500] Status - Different chat report opens when clicking on the back button in Status modal[/-] [+][HOLD for payment 2023-11-29] [$500] Status - Different chat report opens when clicking on the back button in Status modal[/+] on Nov 22, 2023
  13. melvin-bot commented on Nov 22, 2023

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Nov 22, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.1-13 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2023-11-29. 🎊

    After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

    • External issue reporter — Applause Team, so no payment needed
    • Contributor that fixed the issue — @shubham1206agra paid $500 via Upwork
    • Contributor+ that helped on the issue and/or PR — @dukenv0307 paid $500 via Upwork

    For reference, here are some details about the assignees on this issue:

  15. melvin-bot commented on Nov 22, 2023

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@shubham1206agra] The PR that introduced the bug has been identified. Link to the PR:
    • [@shubham1206agra] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@shubham1206agra] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@shubham1206agra] Determine if we should create a regression test for this bug.
    • [@shubham1206agra] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@CortneyOfstad] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/341483
  16. shubham1206agra commented on Nov 24, 2023

    @shubham1206agra
    Contributor

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    1. Open the App with an account that has a status set already.
    2. Open different chat reports.
    3. Click on the status on the top left.
    4. Click on the back button.
  17. CortneyOfstad commented on Dec 1, 2023

    @CortneyOfstad
    Contributor

    @shubham1206agra @dukenv0307 — both of you have been paid in NewDot and regression test was created here — closing!

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions