Skip to content

Conversation

@ggazzo
Copy link
Member

@ggazzo ggazzo commented Apr 25, 2025

Proposed changes (including videos or screenshots)

Introduced here: #35818

Issue(s)

Steps to test or reproduce

Further comments

CORE-1097
CORE-1098
CORE-1099


This pull request addresses a regression issue related to message list navigation in the Rocket.Chat application. The changes focus on improving the user experience when loading older messages by implementing scroll position saving and restoration within the RoomHistoryManager. Specifically, the current scroll position is saved when older messages are loaded using the getMore method, and a new restoreScroll method is introduced to adjust for content height changes. Additionally, a loaded-messages event is emitted after messages are loaded in both getMore and getMoreNext, and a utility function waitAfterFlush is added.

In the useJumpToMessage hook, modifications are made to enhance listRef handling and message scrolling behavior. The useGetMore hook is refactored to use async/await for fetching older messages, introduces flushSync for smoother scroll restoration, and optimizes performance by adding passive: true to the scroll listener. The throttled handler is also ensured to be cancelled on unmount. These improvements aim to enhance the history loading mechanism, although further enhancements in type safety and error handling are suggested.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Apr 25, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.6.0, but it targets 7.7.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Apr 25, 2025

⚠️ No Changeset found

Latest commit: 558cd9e

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.

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 25, 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.

@dougfabris dougfabris changed the base branch from develop to release-7.6.0 April 25, 2025 21:10
@dougfabris dougfabris changed the base branch from release-7.6.0 to develop April 25, 2025 21:11
@github-actions
Copy link
Contributor

github-actions bot commented Apr 25, 2025

PR Preview Action v1.6.1

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

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

@dougfabris dougfabris added this to the 7.6.0 milestone Apr 25, 2025
@codecov
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 54.83871% with 28 lines in your changes missing coverage. Please review.

Project coverage is 61.15%. Comparing base (13824d1) to head (558cd9e).
Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #35880   +/-   ##
========================================
  Coverage    61.15%   61.15%           
========================================
  Files         3014     3015    +1     
  Lines        71597    71635   +38     
  Branches     16398    16405    +7     
========================================
+ Hits         43782    43810   +28     
- Misses       24843    24860   +17     
+ Partials      2972     2965    -7     
Flag Coverage Δ
e2e 57.86% <54.83%> (+<0.01%) ⬆️
e2e-api 35.64% <ø> (+0.04%) ⬆️
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.

@ggazzo ggazzo force-pushed the regression/load-more branch from 2daa7e3 to e746d93 Compare April 25, 2025 22:37
@ggazzo ggazzo marked this pull request as ready for review April 26, 2025 01:44
@ggazzo ggazzo requested a review from a team as a code owner April 26, 2025 01:44
@kody-ai
Copy link

kody-ai bot commented Apr 28, 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 force-pushed the regression/load-more branch 5 times, most recently from 0591ad0 to 36549c9 Compare April 29, 2025 03:49
@ggazzo ggazzo changed the base branch from develop to test/flaky-navigation-preview April 29, 2025 03:50
@ggazzo ggazzo force-pushed the test/flaky-navigation-preview branch from d7a9981 to c199c78 Compare April 29, 2025 19:53
@ggazzo ggazzo force-pushed the regression/load-more branch from 206aef5 to 78cf141 Compare April 29, 2025 21:04
@ggazzo ggazzo changed the title regression: fix jump from pseudo message lists regression: fix jump from message lists Apr 29, 2025
@ggazzo ggazzo force-pushed the regression/load-more branch 2 times, most recently from a2b7d39 to 0f2819c Compare April 30, 2025 00:49
Base automatically changed from test/flaky-navigation-preview to develop April 30, 2025 02:03
@ggazzo ggazzo force-pushed the regression/load-more branch from 0f2819c to 07d5fc9 Compare April 30, 2025 02:04
@kody-ai
Copy link

kody-ai bot commented Apr 30, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

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 force-pushed the regression/load-more branch from 07d5fc9 to 558cd9e Compare April 30, 2025 02:05
@kody-ai
Copy link

kody-ai bot commented Apr 30, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

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.

Copy link
Contributor

@aleksandernsilva aleksandernsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this is a regression, I assume some previous behavior wasn't working as expected. Did our existing tests catch it? Is there anything that can be added to the existing test cases?

</li>
) : (
<MessageListProvider messageListRef={jumpToRef}>
<MessageListProvider messageListRef={jumpToRef as unknown as RefCallback<HTMLElement>}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cast seems a bit risky. If MessageListProvider can receive RefCallback<HTMLElement> | MutableRefObject<HTMLElement> shouldn't that be its type?

@ggazzo
Copy link
Member Author

ggazzo commented Apr 30, 2025

Considering this is a regression, I assume some previous behavior wasn't working as expected. Did our existing tests catch it? Is there anything that can be added to the existing test cases?

not exactly now, I plan to do unit testing as soon as we finish removing meteor dependencies. luckily this is a feature we use daily so we are still somewhat protected

Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we do not have virtualization in the room, I'm afraid we add some e2e test to handle scroll in this list and as it's unstable we'll introduce some intermittence. As we discussed, we're going to add some unit in a near feature, so IMO we are ok to move forward with this now

@jessicaschelly jessicaschelly 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 merged commit 323de5d into develop Apr 30, 2025
50 checks passed
@ggazzo ggazzo deleted the regression/load-more branch April 30, 2025 17:05
ggazzo added a commit that referenced this pull request Apr 30, 2025
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.

5 participants