Skip to content

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

Closed

Description

@OlimpiaZurek

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 9, 2025
  2. melvin-bot commented on Jan 9, 2025

    @melvin-bot

    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.

  3. OlimpiaZurek commented on Jan 9, 2025

    @OlimpiaZurek
    ContributorAuthor

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

  4. added
    ReviewingHas a PR in review
    and removed on Jan 9, 2025
  5. mallenexpensify commented on Jan 10, 2025

    @mallenexpensify
    Contributor

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

  6. OlimpiaZurek commented on Jan 10, 2025

    @OlimpiaZurek
    ContributorAuthor
  7. mallenexpensify commented on Jan 11, 2025

    @mallenexpensify
    Contributor

    Thanks @OlimpiaZurek ! Assigned.

  8. melvin-bot commented on Jan 16, 2025

    @melvin-bot

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

  9. 4 remaining items

  10. melvin-bot commented on Jan 28, 2025

    @melvin-bot

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

  11. melvin-bot commented on Jan 28, 2025

    @melvin-bot

    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:

  12. melvin-bot commented on Jan 28, 2025

    @melvin-bot

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

  13. hoangzinh commented on Jan 28, 2025

    @hoangzinh
    Contributor

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

  14. melvin-bot commented on Feb 4, 2025

    @melvin-bot

    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
  15. hoangzinh commented on Feb 4, 2025

    @hoangzinh
    Contributor

    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.

  16. hoangzinh commented on Feb 4, 2025

    @hoangzinh
    Contributor

    Requested payment in ND

  17. mallenexpensify commented on Feb 5, 2025

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

  18. garrettmknight commented on Feb 11, 2025

    @garrettmknight
    Contributor

    $250 approved for @hoangzinh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions