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

[HOLD for payment 2024-08-29] [$250] iOS - Thread - Back button in the main chat reopens main chat after leaving thread #46123

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 24, 2024 · 37 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 24, 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.11-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4760347
Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Go to DM
  3. Send a message
  4. Long press on the message > Reply in thread
  5. Send a reply in thread
  6. Tap on the report header
  7. Tap Leave
  8. Tap back button on the top left in the main chat

Expected Result:

App will return to LHN

Actual Result:

App reopens the main chat

Workaround:

Unknwon

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

Bug6551503_1721825710340.ScreenRecording_07-24-2024_20-48-43_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014c369a294716b5b5
  • Upwork Job ID: 1816166555115213621
  • Last Price Increase: 2024-07-31
Issue OwnerCurrent Issue Owner: @garrettmknight / @jliexpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 24, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

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

We think that this bug might be related to #wvip-vsp

@lanitochka17
Copy link
Author

@garrettmknight 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

@FitseTLT
Copy link
Contributor

Proposal

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

Thread - Back button in the main chat reopens main chat after leaving thread

What is the root cause of that problem?

We are navigating to last accessed report after leaving room here

App/src/libs/actions/Report.ts

Lines 2790 to 2791 in a79189f

navigateToMostRecentReport(report);
}

Which is the main chat from which the thread was created. Therefore, when we navigate back we navigate to main chat once again as it existed in the navigation route state even before leaving thread.

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

This behaviour is expected for leaving room but for leaving chat thread we should only goBack, so change

App/src/libs/actions/Report.ts

Lines 2790 to 2791 in a79189f

navigateToMostRecentReport(report);
}

if (isChatThread) {
        Navigation.goBack();
    } else {
        navigateToMostRecentReport(report);
    }

What alternative solutions did you explore? (Optional)

@dominictb
Copy link
Contributor

dominictb commented Jul 24, 2024

Proposal

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

App reopens the main chat

What is the root cause of that problem?

After leaving the thread, we call navigateToMostRecentReport

navigateToMostRecentReport(report);

In the detail implementation of navigateToMostRecentReport, we trigger goBack with fallbackRoute.

Navigation.goBack(lastAccessedReportRoute);

In this case, fallbackRoute is the last route, so it's duplicated.

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

We should call goBack to remove the current route, then go to the correspond lastAccessedReportRoute like what we already did in here

if (lastAccessedReportID) {
        const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? '-1');
        Navigation.goBack();
        Navigation.navigate(lastAccessedReportRoute)
    } else {

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

Pressing the back button after leaving a thread shows the main chat again.

What is the root cause of that problem?

When we leave a thread, we already call dismiss modal to close the RHP first,

const leaveChat = useCallback(() => {
Navigation.dismissModal();
if (isRootGroupChat) {
Report.leaveGroupChat(report.reportID);
return;
}
const isWorkspaceMemberLeavingWorkspaceRoom = (report.visibility === CONST.REPORT.VISIBILITY.RESTRICTED || isPolicyExpenseChat) && isPolicyEmployee;
Report.leaveRoom(report.reportID, isWorkspaceMemberLeavingWorkspaceRoom);
}, [isPolicyEmployee, isPolicyExpenseChat, isRootGroupChat, report.reportID, report.visibility]);

the leaveChat then calls navigateToMostRecentReport to perform goBack with a fallback route of the main chat report.

App/src/libs/actions/Report.ts

Lines 2660 to 2663 in 98eb1bb

if (lastAccessedReportID) {
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? '-1');
Navigation.goBack(lastAccessedReportRoute);
} else {

In an ideal case, the RHP is already closed and the goBack with the fallback route will pop every report screen until it's arrived at the fallback route.

if (isCentralPaneFocused && fallbackRoute) {
// Allow CentralPane to use UP with fallback route if the path is not found in root navigator.
if (distanceFromPathInRootNavigator === -1) {
navigate(fallbackRoute, CONST.NAVIGATION.TYPE.UP);
return;
}
// Add possibility to go back more than one screen in root navigator if that screen is on the stack.
if (distanceFromPathInRootNavigator > 0) {
navigationRef.current.dispatch(StackActions.pop(distanceFromPathInRootNavigator));

However, in this case, the RHP is still in the nav state stack, so the goBack will replace the RHP with the main chat report.

if (shouldEnforceFallback || (isFirstRouteInNavigator && fallbackRoute)) {
navigate(fallbackRoute, CONST.NAVIGATION.TYPE.UP);
return;
}

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

We need to delay the navigation like we did in #44537.

Navigation.dismissModal();
Navigation.isNavigationReady().then(() => // leaveRoom / leaveGroupChat);

or use setTimeout/InteractionManager/useWaitForNavigate hook

@garrettmknight garrettmknight added the External Added to denote the issue can be worked on by a contributor label Jul 24, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

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

@melvin-bot melvin-bot bot changed the title iOS - Thread - Back button in the main chat reopens main chat after leaving thread [$250] iOS - Thread - Back button in the main chat reopens main chat after leaving thread Jul 24, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 24, 2024
@garrettmknight garrettmknight removed their assignment Jul 24, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

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

@garrettmknight garrettmknight added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Jul 24, 2024
Copy link

melvin-bot bot commented Jul 24, 2024

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

@garrettmknight garrettmknight self-assigned this Jul 24, 2024
@garrettmknight
Copy link
Contributor

@jliexpensify I'm headed out until August 5th. I'll pick this back up when I'm back. Thanks for your help in the meantime!

@jliexpensify
Copy link
Contributor

No worries! Bumping @eVoloshchak for reviews please.

Copy link

melvin-bot bot commented Jul 29, 2024

@garrettmknight, @eVoloshchak, @jliexpensify Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@jliexpensify
Copy link
Contributor

Bumping @eVoloshchak for reviews! Also bumping on Slack.

@eVoloshchak
Copy link
Contributor

I think we should proceed with @bernhardoj's proposal, this is the easiest and most reliable approach

🎀👀🎀 C+ reviewed!

@melvin-bot melvin-bot bot removed the Overdue label Jul 30, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.23-0 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 2024-08-29. 🎊

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

  • @eVoloshchak requires payment through NewDot Manual Requests
  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented Aug 22, 2024

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:

  • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] Determine if we should create a regression test for this bug.
  • [@eVoloshchak] 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.
  • [@garrettmknight / @jliexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@jliexpensify jliexpensify removed their assignment Aug 23, 2024
@jliexpensify
Copy link
Contributor

Garrett is back! Unassigning myself

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 28, 2024
Copy link

melvin-bot bot commented Aug 29, 2024

Payment Summary

Upwork Job

BugZero Checklist (@garrettmknight)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1816166555115213621/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@garrettmknight
Copy link
Contributor

Payment summary looks right to me:

  • @eVoloshchak can you finish the checklist before you request payment?
  • @bernhardoj please request payment when you're ready.

@bernhardoj
Copy link
Contributor

Requested in ND.

@melvin-bot melvin-bot bot added the Overdue label Sep 2, 2024
@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: I'm unable to pinpoint the PR that has caused this, looks like this is the original implementation
  • 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: N/A
  • 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: this is a pretty straightforward bug, I don't think an additional discussion is needed

Regression Test Proposal

  1. Open any chat
  2. Send a message
  3. Reply in the thread of the message
  4. Press the chat header and press Leave
  5. Verify you are navigated back to the main chat
  6. Press the go back button
  7. Verify you are navigated back to LHN

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot removed the Overdue label Sep 2, 2024
@garrettmknight garrettmknight added Weekly KSv2 and removed Daily KSv2 labels Sep 2, 2024
@garrettmknight
Copy link
Contributor

Dropping to weekly while @eVoloshchak request payment.

@JmillsExpensify
Copy link

$250 approved for @eVoloshchak

@JmillsExpensify
Copy link

JmillsExpensify commented Sep 2, 2024

$250 approved for @bernhardoj

@garrettmknight
Copy link
Contributor

@JmillsExpensify did you get the request from @bernhardoj too?

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2024
@garrettmknight
Copy link
Contributor

@JmillsExpensify bump

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 20, 2024
@garrettmknight garrettmknight added Daily KSv2 and removed Weekly KSv2 labels Sep 23, 2024
@melvin-bot melvin-bot bot removed the Overdue label Sep 23, 2024
@JmillsExpensify
Copy link

Yes, I did. I updated my comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: CRITICAL
Development

No branches or pull requests

9 participants