Skip to content

Conversation

@ggazzo
Copy link
Member

@ggazzo ggazzo commented Apr 29, 2025

https://rocketchat.atlassian.net/browse/ARCH-1585

found during #35880

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments


This pull request aims to address an issue in the Rocket.Chat repository by preventing multiple listener.once calls to updateSubscription. The changes are made in two files:

  1. readStateManager.ts: A new method has been added to subscribe to message loading events and update the first unread record ID.

  2. useChatMessagesInstance.ts: A useEffect hook is introduced to manage message subscriptions using chatMessages.readStateManager. The hook utilizes optional chaining to avoid runtime errors when subscription or chatMessages are temporarily undefined.

These updates are intended to enhance the management of message subscriptions and improve the stability of the chat application.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Apr 29, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Apr 29, 2025

⚠️ No Changeset found

Latest commit: 5eea8cf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kody-ai
Copy link

kody-ai bot commented Apr 29, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@ggazzo ggazzo added this to the 7.7.0 milestone Apr 29, 2025
@github-actions
Copy link
Contributor

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35908/

Built to branch gh-pages at 2025-04-29 21:21 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.15%. Comparing base (4f0bc99) to head (5eea8cf).
Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #35908      +/-   ##
===========================================
- Coverage    61.16%   61.15%   -0.01%     
===========================================
  Files         3014     3014              
  Lines        71625    71628       +3     
  Branches     16403    16404       +1     
===========================================
- Hits         43808    43806       -2     
- Misses       24850    24855       +5     
  Partials      2967     2967              
Flag Coverage Δ
e2e 57.87% <100.00%> (-0.02%) ⬇️
unit 75.10% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kody-ai
Copy link

kody-ai bot commented Apr 29, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@ggazzo ggazzo marked this pull request as ready for review April 30, 2025 19:15
@ggazzo ggazzo requested a review from a team as a code owner April 30, 2025 19:15
@gabriellsh gabriellsh added the stat: QA assured Means it has been tested and approved by a company insider label Apr 30, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 30, 2025
@ggazzo ggazzo changed the title fix: prevent multiple listener.once updateSubscription chore: prevent multiple listener.once updateSubscription Apr 30, 2025
@kody-ai
Copy link

kody-ai bot commented Apr 30, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@ggazzo ggazzo merged commit a4ea0b5 into develop Apr 30, 2025
17 of 18 checks passed
@ggazzo ggazzo deleted the fix/leak-ev branch April 30, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants