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

mWeb - Chat scrolls back to linked message after receiving new message #45093

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 9, 2024 · 23 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 9, 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.5.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: N/A
Email or phone of affected tester (no customers): u.onyeukwu94@gmail.com
Issue reported by: Applause - Internal Team

Issue found when executing PR #44819

Action Performed:

  1. Open a chat conversation with a user(B) that has scrollable history
  2. Go to the top comment and copy the link to that comment
  3. Open another chat, send link and tap link to navigate to comment
  4. Scroll to bottom to chat conversation
  5. With User B, send any message to chat

Expected Result:

User receives new message smoothly

Actual Result:

Chat conversation scrolls up to highlighted message that was navigated to initially

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

Bug6536085_1720456321183.Bug_.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 9, 2024
Copy link

melvin-bot bot commented Jul 9, 2024

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

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

@lanitochka17
Copy link
Author

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

@jacobkim9881
Copy link
Contributor

I guess this came from #41962

@ishpaul777
Copy link
Contributor

I guess this came from #41962

PR is not on Prod. yet this issue is also reproducable on prod. so not from #41962

@tsa321
Copy link
Contributor

tsa321 commented Jul 10, 2024

Proposal

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

Chat scrolls back to linked message after receiving new message

What is the root cause of that problem?

Here:

useLayoutEffect(() => {
setCurrentReportActionID('');
}, [route]);

and here:

const listID = useMemo(() => {
if (!reportActionID) {
// Keep the old list ID since we're not in the Comment Linking flow
return listOldID;
}
isFirstLinkedActionRender.current = true;
const newID = generateNewRandomInt(listOldID, 1, Number.MAX_SAFE_INTEGER);
// eslint-disable-next-line react-compiler/react-compiler
listOldID = newID;
return newID;
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [route, isLoadingInitialReportActions, reportActionID]);

We the useMemo and useLayoutEffect rely on route, which comes from useRoute. Every time the user receives a new message, the route object changes and triggers both useMemo and useLayoutEffect. Inside useMemo, isFirstLinkedActionRender.current is set to true, causing the report to scroll to the linked message.

The changes to the route object/navigation state occur due to:

Navigation.setParams({referrer: undefined});

The Navigation.setParams({ referrer: undefined }) call alters the navigation state and updates the route object.

What changes should we make to solve the problem?

To address this issue, we should add a check before executing Navigation.setParams({ referrer: undefined }). For example:

if (isFromNotification) {
    Navigation.setParams({ referrer: undefined });
}

Alternative solution:

Another approach could be to adjust the dependencies of useMemo and useLayoutEffect to use route.path instead of route.

@ishpaul777
Copy link
Contributor

i am interested in taking over this issue as c+, i have good context working on comment-linking related issues. : )

@melvin-bot melvin-bot bot added the Overdue label Jul 11, 2024
Copy link

melvin-bot bot commented Jul 12, 2024

@bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot removed the Overdue label Jul 14, 2024
@bfitzexpensify bfitzexpensify added External Added to denote the issue can be worked on by a contributor Overdue labels Jul 14, 2024
Copy link

melvin-bot bot commented Jul 14, 2024

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

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

Cool, assigning you @ishpaul777

Copy link

melvin-bot bot commented Jul 14, 2024

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

@ishpaul777
Copy link
Contributor

@tsa321's Proposal looks good to me and test well.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 15, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 15, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review and removed Daily KSv2 labels Jul 16, 2024
@melvin-bot melvin-bot bot added the Weekly KSv2 label Jul 16, 2024
@tsa321
Copy link
Contributor

tsa321 commented Jul 16, 2024

@ishpaul777 PR is ready.

@ishpaul777
Copy link
Contributor

ishpaul777 commented Jul 24, 2024

fix for this was deployed to Prod yesterday.

@tsa321
Copy link
Contributor

tsa321 commented Aug 5, 2024

cc: @bfitzexpensify . I think melvin automation broken here.

@tsa321
Copy link
Contributor

tsa321 commented Aug 12, 2024

^^ cc @bfitzexpensify

@bfitzexpensify
Copy link
Contributor

@tsa321 can you please link your Upwork profile?

@tsa321
Copy link
Contributor

tsa321 commented Aug 20, 2024

@bfitzexpensify bfitzexpensify added Daily KSv2 and removed Weekly KSv2 labels Aug 21, 2024
@bfitzexpensify
Copy link
Contributor

Offer sent @tsa321.

I'm now out of office, so adding a BZ buddy to finalise the payout

@ishpaul777 can you complete the BZ checklist:

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

@bfitzexpensify bfitzexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Aug 21, 2024
Copy link

melvin-bot bot commented Aug 21, 2024

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

@tsa321
Copy link
Contributor

tsa321 commented Aug 21, 2024

@bfitzexpensify I have accepted the offer.

@ishpaul777
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Fix mark message from notification #41484

  • 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: https://github.com/Expensify/App/pull/41484/files#r1727608316

  • 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: not required

  • Determine if we should create a regression test for this bug. Not requires

  • 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. N.A

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

7 participants