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

[Awaiting Payment March 20th] [$500] Report - The conversation scrolls to the beginning when you open the settings menu #35763

Closed
2 of 6 tasks
izarutskaya opened this issue Feb 3, 2024 · 64 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Feb 3, 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: 1.4.36-0
Reproducible in staging?: Y
Reproducible in production?: N
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:

  1. Open https://staging.new.expensify.com/
  2. Log in under your HT account A
  3. Navigate to a conversation with more messages
  4. Scroll to the top of your conversation history so that the last message is not visible
  5. Open settings via avatar
  6. Close the setting via the "Back" arrow

Expected Result:

When you close the settings menu, the conversation should not restart and scroll back to the beginning.

Actual Result:

The conversation scrolls to the beginning when you open the settings menu

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

Bug6366093_1706977070977.Recording__1272.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0154928522b8004b1d
  • Upwork Job ID: 1753894702380920832
  • Last Price Increase: 2024-03-18
  • Automatic offers:
    • akinwale | Reviewer | 0
Issue OwnerCurrent Issue Owner: @trjExpensify
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 3, 2024
@melvin-bot melvin-bot bot changed the title Report - The conversation scrolls to the beginning when you open the settings menu [$500] Report - The conversation scrolls to the beginning when you open the settings menu Feb 3, 2024
Copy link

melvin-bot bot commented Feb 3, 2024

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

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

melvin-bot bot commented Feb 3, 2024

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

Copy link

melvin-bot bot commented Feb 3, 2024

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 3, 2024
Copy link
Contributor

github-actions bot commented Feb 3, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Feb 3, 2024

Triggered auto assignment to @neil-marcellini (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@izarutskaya
Copy link
Author

We think that this bug might be related to #vip-vsb
CC @quinthar

@sahilnagpal26
Copy link
Contributor

sahilnagpal26 commented Feb 4, 2024

Proposal

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

The conversation scrolls to the beginning when you open the settings menu

What is the root cause of that problem?

This happens because when we press the back button, we call
closeFullScreen which leads to this state

onBackButtonPress={() => Navigation.closeFullScreen()}

closeFullScreen uses StackActions.popToTop()which takes us back to the first screen in the stack, dismissing all the others. Once this happens, ReportScreen Component is rendered, however, the report prop in this case is set to {}. ReportScreen component renders ReportActionsView which internally invokes openReportIfNecessary. As props.report.isOptimisticReport is false, Report.openReport(reportID) is invoked, leading to a network call and fetching the messages again. This leads to re-rendering of the messages and the movement to the most recent message in the chat.

Screenshot 2024-02-09 at 4 51 06 AM

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

We can instead use Navaigation.dismissModal on the press of the back button. This internally invokes StackActions.pop(). In this case when ReportScreen component is rendered, we already have the report prop. So, when ReportActionsView which internally invokes openReportIfNecessary. As props.report.isOptimisticReport is true, it simply returns without invoking Report.openReport(reportID) and hence the scroll is maintained.

Screenshot 2024-02-04 at 8 35 38 AM

const dismissModal = (reportID?: string, ref = navigationRef) => {
if (!reportID) {
originalDismissModal(ref);
return;
}
const report = getReport(reportID);
originalDismissModalWithReport({reportID, ...report}, ref);

What alternative solutions did you explore? (Optional)

@muas19
Copy link

muas19 commented Feb 4, 2024

When I press back, I'm taken to LHN, not the previous screen as OP has mentioned.

@mountiny mountiny added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Feb 5, 2024
@mountiny
Copy link
Contributor

mountiny commented Feb 5, 2024

This does not need to be a blocker, user is not limited in use of the app

@akinwale please review the proposals once you will have time, thank you

@akinwale
Copy link
Contributor

akinwale commented Feb 6, 2024

@sahilnagpal26's proposal correctly identifies the root cause and the suggested solution is valid.

🎀👀🎀 C+ reviewed.

Copy link

melvin-bot bot commented Feb 6, 2024

Current assignee @neil-marcellini is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@sahilnagpal26
Copy link
Contributor

@akinwale As this is going to be my first contribution. I wanted to understand what should be my next action here? Should I create a PR For the same.

@akinwale
Copy link
Contributor

akinwale commented Feb 6, 2024

@sahilnagpal26 You will be assigned to the issue, but you can go ahead and create the PR so that you can get all the first-timer tasks done (signing the CLA, etc).

@neil-marcellini
Copy link
Contributor

@sahilnagpal26's proposal correctly identifies the root cause and the suggested solution is valid.

🎀👀🎀 C+ reviewed.

@sahilnagpal26 It seems like the solution probably works given that it's easy to test, but does it have unwanted side effects? I think the root cause analysis needs a lot more explanation. Why is Navigation.closeFullScreen() not the right approach? Why is it causing the report to scroll back to the latest message?

I want to make sure I understand this, given that I don't have much experience with our navigation system. Please edit your proposal and let me know when it's updated. Please refrain from creating a PR until you are assigned by an internal engineer.

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

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

@sahilnagpal26
Copy link
Contributor

@trjExpensify I am trying to figure out a solution, however, its taking time longer than I expected.

@melvin-bot melvin-bot bot added the Overdue label Mar 13, 2024
@trjExpensify
Copy link
Contributor

Appreciate the update. If you need to brainstorm, please do feel encouraged to use the #expensify-open-source channel and tag a few people that have been involved in the original PR(s).

@melvin-bot melvin-bot bot removed the Overdue label Mar 13, 2024
@adamgrzybowski
Copy link
Contributor

@sahilnagpal26 Make sure that you have the newest changes. There were some changes related to the navigation in this PR

@melvin-bot melvin-bot bot added the Overdue label Mar 15, 2024
@trjExpensify
Copy link
Contributor

@sahilnagpal26 do you have a plan to address the issues this week?

@melvin-bot melvin-bot bot removed the Overdue label Mar 18, 2024
@adamgrzybowski
Copy link
Contributor

@trjExpensify Something to check, but I think this issue may no longer exist after the release of ideal-nav-v2. At least I can't reproduce it.

Copy link

melvin-bot bot commented Mar 18, 2024

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

@trjExpensify
Copy link
Contributor

Oh, good point! Because we've moved the settings page to the avatar in the bottom tab, we don't push a "full screen" modal on top of the chats list anymore with the recent changes, right? So then I think the question evolves to:

When you switch between the bottom tabs, should your scroll position in the chat be maintained? It doesn't look like that's the case on staging, but I think you would want that.

dKHthPzh3y.mp4

Equally, I think you want your scroll position to be maintained when switching between two chats though, but it also seems like that's not working either:

LFd6EIFfP0.mp4

@roryabraham @mountiny @luacmartins @JmillsExpensify, am I missing something (maybe comment linking related?) as to why maintaining the scroll position inside the chat might not be working? 🤔

@adamgrzybowski
Copy link
Contributor

adamgrzybowski commented Mar 19, 2024

@trjExpensify When we switch chats -> settings -> chats the second time we see a chat screen it is a different component than the first time we saw it. Even if it is the same report.

This is done to achieve the desired history pattern in the browser.

The disadvantage of this solution is that because the scroll position is saved on the screen, it is reset after such navigation

If you would go back twice in the browser after that you would see that the initial scroll position is still there.

To solve similar problem for the BottomTabNavigator I created this PR
It use global context to have consistent scroll position between different screen components with the same params.

I think this solution potentially could be extended to cover the report screen cases.

@trjExpensify
Copy link
Contributor

trjExpensify commented Mar 19, 2024

Ah okay cool, so we have an issue for that PR to progress it. Would be good if it's extendable to cover the report screen cases, but we can look into that over there.

Okay, so I think we can move to close this issue out now. We do need to settle up with @sahilnagpal26 & @akinwale for the initial work prior to the app changes.

Payment summary as follows:

$250 to @sahilnagpal26 for the fix
$250 to @akinwale for the C+ review

Two regressions (1, 2) came out of the PR, but one was known, so deducted accordingly for only one per the contributor guidelines.

@akinwale, let me know I didn't miss anything on the above, and I'll go ahead and issue payments. 👍

@trjExpensify trjExpensify added Awaiting Payment Auto-added when associated PR is deployed to production and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Mar 19, 2024
@akinwale
Copy link
Contributor

@trjExpensify #36888 was already a known issue prior to the PR being submitted as the performance problem was identified beforehand (context), so I think one regression deduction applies here.

@adamgrzybowski
Copy link
Contributor

@trjExpensify

Ah okay cool, so we have an issue for that PR to progress it. Would be good if it's extendable to cover the report screen cases, but we can look into that over there.

I would merge the PR for scroll on the HOME page and ask somebody from SWM to use this code to create similar solution for the report screen scroll.

Do you want to create and issue for that?

@mountiny
Copy link
Contributor

mountiny commented Mar 20, 2024

Seems like this got handled well. We got an issue for the bottom tabs and PR to fix it going on

@trjExpensify with the chats I guess it depends, you can see Slack keeps the position. WhatsApp desktop does not though, I think we can explore how to solve this but we need to make sure it will solve well and would not hurt performance even if we would store the position for many reports (or put some limit on 10 latest visited reports for example.)

@trjExpensify
Copy link
Contributor

@trjExpensify #36888 was already a known issue prior to the PR being submitted as the performance problem was identified beforehand (#35763 (comment)), so I think one regression deduction applies here.

Ah okay, got it. Cool, updated the payment summary. Offers sent to you both!

@trjExpensify trjExpensify changed the title [$500] Report - The conversation scrolls to the beginning when you open the settings menu [Awaiting Payment March 20th] [$500] Report - The conversation scrolls to the beginning when you open the settings menu Mar 20, 2024
@akinwale
Copy link
Contributor

@trjExpensify Accepted. Thanks!

@trjExpensify
Copy link
Contributor

@trjExpensify with the chats I guess it depends, you can see Slack keeps the position. WhatsApp desktop does not though, I think we can explore how to solve this but we need to make sure it will solve well and would not hurt performance even if we would store the position for many reports (or put some limit on 10 latest visited reports for example.)

Yeah, maybe we can bring this out for a discussion in somewhere like #vip-vsb to decide what we want to do. I agree we don't want to take a performance hit, but I do think keeping the position will be desirable when we use this a lot for all of our business chat purposes where you're switching a lot.

@trjExpensify
Copy link
Contributor

@trjExpensify Accepted. Thanks!

Paid!

@trjExpensify
Copy link
Contributor

@sahilnagpal26 waiting for you to accept the offer.

@melvin-bot melvin-bot bot added the Overdue label Mar 25, 2024
@trjExpensify
Copy link
Contributor

@sahilnagpal26 paid. Closing!

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests