Skip to content

[HOLD for payment 2025-02-04] Improve FloatingMessageCounter performance #55001

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
OlimpiaZurek opened this issue Jan 9, 2025 · 15 comments
Closed
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@OlimpiaZurek
Copy link
Contributor

OlimpiaZurek commented Jan 9, 2025

Background

The FloatingMessageCounter component is used to display the number of unread messages in a chat thread.

Problem

It causes unnecessary re-renders when the user switches workspaces or when modals are opened or closed.

Solution

Wrap the scrollToBottomAndMarkReportAsRead function in useCallback to ensure it is not recreated on every render. This will prevent unnecessary re-renders during workspace switches, modal interactions, and message updates. Wrapping the function in useCallback will ensure it is only recreated when necessary, leading to smoother transitions and more efficient interactions.

Before:
FloatingMessageCounter_before

After:
FloatingMessageCounter_after

Issue OwnerCurrent Issue Owner: @mallenexpensify
@OlimpiaZurek OlimpiaZurek added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 9, 2025
Copy link

melvin-bot bot commented Jan 9, 2025

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

@OlimpiaZurek
Copy link
Contributor Author

Hi! I'm Olimpia from Callstack and I'd like to work on this issue.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jan 9, 2025
@mallenexpensify
Copy link
Contributor

Hi @OlimpiaZurek , is there a discuss about this anywhere in Slack? If so, can you link to it plz? Thx

@OlimpiaZurek
Copy link
Contributor Author

Hey @mallenexpensify, here is the link to the slack thread: https://callstack-hq.slack.com/archives/C05LX9D6E07/p1736329695333529

@mallenexpensify
Copy link
Contributor

Thanks @OlimpiaZurek ! Assigned.

Copy link

melvin-bot bot commented Jan 16, 2025

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

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 28, 2025
@melvin-bot melvin-bot bot changed the title Improve FloatingMessageCounter performance [HOLD for payment 2025-02-04] Improve FloatingMessageCounter performance Jan 28, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 28, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

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

Copy link

melvin-bot bot commented Jan 28, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.89-8 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 2025-02-04. 🎊

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

Copy link

melvin-bot bot commented Jan 28, 2025

@jasperhuangg @mallenexpensify @OlimpiaZurek The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@hoangzinh
Copy link
Contributor

@mallenexpensify could you help to assign this issue to me? I helped to review the PR #54944

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 3, 2025
Copy link

melvin-bot bot commented Feb 4, 2025

Payment Summary

Upwork Job

  • Reviewer: @hoangzinh owed $250 via NewDot
  • Contributor: @OlimpiaZurek is from an agency-contributor and not due payment

BugZero Checklist (@mallenexpensify)

  • 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//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@hoangzinh
Copy link
Contributor

hoangzinh commented Feb 4, 2025

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other: It's an improve/enhance issue

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other: Slack

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other: Callstack, expert contributor
  • [Contributor] 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/18637/files#r1940947117

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Nope, it's just an improvement issue for existing behavior.

@hoangzinh
Copy link
Contributor

Requested payment in ND

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2025
@mallenexpensify
Copy link
Contributor

Contributor+: @hoangzinh due $250 via NewDot

Doesn't look like we need a test case or update of one for this, plz comment if you disagree

@garrettmknight
Copy link
Contributor

$250 approved for @hoangzinh

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

No branches or pull requests

5 participants