Skip to content

[YAUHENI - CHECKLIST][$250] Chat - Chat not scrolled to bottom when returned from thread and send a message #46290

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

Closed
5 of 6 tasks
lanitochka17 opened this issue Jul 26, 2024 · 27 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 Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 26, 2024

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: 9.0.13-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: https://expensify.testrail.io/index.php?/tests/view/4766826&group_by=cases:section_id&group_order=asc&group_id=306202
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

Precondition: user should be Signed In with [email protected]
account

  1. Open app
  2. Navigate to chat with [email protected]
  3. Scroll up the chat
  4. Navigate to any thread for any message in the chat
  5. Click on the "From" link in header to navigate back to the main chat
  6. Send any message

Expected Result:

Chat should be scrolled to the bottom when user send a message to the chat

Actual Result:

"New message" button displayed and chat remains on the same position

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

Add any screenshot/video evidence

Bug6553078_1721940541808.Screen_Recording_2024-07-25_at_23.36.21.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018faeb9106bd08688
  • Upwork Job ID: 1817743200562670608
  • Last Price Increase: 2024-07-29
  • Automatic offers:
    • ZhenjaHorbach | Reviewer | 103368524
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @jliexpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 26, 2024
Copy link

melvin-bot bot commented Jul 26, 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.

@bernhardoj
Copy link
Contributor

Proposal

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

Chat doesn't scroll to bottom after coming back from thread using the parent link.

What is the root cause of that problem?

When we add the message, it will only scroll to the bottom if hasNewestReportActionRef is true.

const scrollToBottomForCurrentUserAction = useCallback(
(isFromCurrentUser: boolean) => {
// If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where
// they are now in the list.
if (!isFromCurrentUser || !hasNewestReportActionRef.current) {
return;
}

However, in our case, hasNewestReportActionRef is false. When we link to a message, the component will take the report actions only up to the current linked action + 50 actions (pagination size).

const paginationSize = getInitialPaginationSize;
return combinedReportActions.slice(Math.max(indexOfLinkedAction - paginationSize, 0));

So, if the message that we linked is very far above, then the scroll to bottom does nothing.

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

We can use the same solution with scroll to bottom by clicking the "New message" here which removes the linked action param so all the report actions are loaded.

const scrollToBottomAndMarkReportAsRead = () => {
if (!hasNewestReportAction) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
Report.openReport(report.reportID);
return;
}
reportScrollManager.scrollToBottom();
readActionSkipped.current = false;
Report.readNewestAction(report.reportID);

if (!hasNewestReportActionRef.current) {
    Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
}
InteractionManager.runAfterInteractions(() => reportScrollManager.scrollToBottom());

@jliexpensify
Copy link
Contributor

Hi @bernhardoj - are you repro-ing this issue with your own account? If it's affecting 1 specific account, we probably don't need to fix it, but if it's affecting other accounts, we should.

I haven't been able to repro on my own test account.

@bernhardoj
Copy link
Contributor

@jliexpensify yes, I can repro it. The issue doesn't depend on the account. To repro the issue, you need to link to the >= 52nd message (you can count it on the video too). For example, if you send 1,2,3,4,...100 to the chat, then you can copy the link of 40 and open it. This is due to pagination logic that only includes the current linked message + 50 messages below (40 + 50 = 90, 91-100 isn't included).

@jliexpensify
Copy link
Contributor

Oh interesting, thanks for that info!

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

melvin-bot bot commented Jul 29, 2024

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

@melvin-bot melvin-bot bot changed the title Chat - Chat not scrolled to bottom when returned from thread and send a message [$250] Chat - Chat not scrolled to bottom when returned from thread and send a message Jul 29, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

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

@ZhenjaHorbach
Copy link
Contributor

@bernhardoj
Thanks for your proposal
Your proposal makes sense to me and also fixes the issue !

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 29, 2024

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

Copy link

melvin-bot bot commented Aug 1, 2024

@jliexpensify, @ZhenjaHorbach, @hayata-suenaga Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Aug 1, 2024
@melvin-bot melvin-bot bot removed the Overdue label Aug 2, 2024
@jliexpensify jliexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

Current assignee @ZhenjaHorbach is eligible for the External assigner, not assigning anyone new.

@jliexpensify
Copy link
Contributor

Hayata is no longer with us, removing him.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Aug 2, 2024

In that case, let's try again

@bernhardoj Thanks for your proposal Your proposal makes sense to me and also fixes the issue !

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 2, 2024

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

@MonilBhavsar
Copy link
Contributor

looks good to me 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

📣 @ZhenjaHorbach 🎉 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

@bernhardoj
Copy link
Contributor

PR is ready

cc: @ZhenjaHorbach

Copy link

melvin-bot bot commented Aug 19, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Aug 26, 2024
Copy link

melvin-bot bot commented Aug 26, 2024

This issue has not been updated in over 15 days. @jliexpensify, @MonilBhavsar, @bernhardoj, @ZhenjaHorbach eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Aug 26, 2024
@MonilBhavsar
Copy link
Contributor

The PR was deployed to production. We can issue the payment here

@MonilBhavsar MonilBhavsar added Awaiting Payment Auto-added when associated PR is deployed to production Weekly KSv2 and removed Monthly KSv2 labels Aug 26, 2024
@MonilBhavsar MonilBhavsar changed the title [$250] Chat - Chat not scrolled to bottom when returned from thread and send a message [Awaiting payment][$250] Chat - Chat not scrolled to bottom when returned from thread and send a message Aug 26, 2024
@MonilBhavsar MonilBhavsar removed the Reviewing Has a PR in review label Aug 26, 2024
@jliexpensify
Copy link
Contributor

Thanks @MonilBhavsar!

Payment Summary

Upwork job

@jliexpensify
Copy link
Contributor

Paid and job closed, waiting on checklist

@jliexpensify jliexpensify removed the Awaiting Payment Auto-added when associated PR is deployed to production label Aug 27, 2024
@jliexpensify jliexpensify changed the title [Awaiting payment][$250] Chat - Chat not scrolled to bottom when returned from thread and send a message [YAUHENI - CHECKLIST][$250] Chat - Chat not scrolled to bottom when returned from thread and send a message Aug 27, 2024
@bernhardoj
Copy link
Contributor

Requested in ND.

@MonilBhavsar
Copy link
Contributor

@jliexpensify Yes, we need a checklist here cc @ZhenjaHorbach

@ZhenjaHorbach
Copy link
Contributor

I will add checklist today or tomorrow !

@ZhenjaHorbach
Copy link
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:

  • [@ZhenjaHorbach] The PR that introduced the bug has been identified. Link to the PR:

I couldn't find a specific PR related to this issuee.
Plus the goal of this PR was to implement logic similar to the one used when clicking the "New messages" button.

  • [@ZhenjaHorbach] 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:

NA

  • [@ZhenjaHorbach] 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:

NA

  • [@ZhenjaHorbach] Determine if we should create a regression test for this bug.
  • [@ZhenjaHorbach] 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.

Regression Test Proposal

  • Send or open a chat with a lot messages (For example more than 60 messages)
  • Right-click/long-press on the first message and Reply in thread
  • Press the "From..." link to go back to the main chat
  • Send a message
  • Verify the chat is scrolled to the bottom

Do we agree 👍 or 👎

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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 Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants