fix: chat fails to load older messages when scrolling to the top#6861
fix: chat fails to load older messages when scrolling to the top#6861
Conversation
WalkthroughRemoved the COUNT_LIMIT usage in loadMessagesForRoom.ts, replaced comparisons to use COUNT directly, set fetch param Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
app/lib/methods/loadMessagesForRoom.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: ESLint and Test / run-eslint-and-test
| import { generateLoadMoreId } from './helpers/generateLoadMoreId'; | ||
|
|
||
| const COUNT = 50; | ||
| const COUNT_LIMIT = COUNT * 10; |
There was a problem hiding this comment.
We've done this for a reason…
A few months ago, we had an issue with large threads being used as the last message.
If you test a thread with more than 100 replies as the last message in develop and in this branch, you'll see that this change rolls back the fix.
| develop | your branch |
|---|---|
![]() |
![]() |
We must find a smart way to make it work without overloading in long-thread cases, if you want we can try to find a solution together on DM.
|
Android Build Available Rocket.Chat Experimental 4.69.0.108033 |
|
iOS Build Available Rocket.Chat Experimental 4.69.0.108129 |
OtavioStasiak
left a comment
There was a problem hiding this comment.
Looks good to me!
Great job!


Proposed changes
This PR fixes an issue where scrolling to the top of a DM or Room chat would get stuck and fail to load older messages.
To fix this, I observed how the web handles message loading and found that it only loads room level messages while excluding thread messages. Thread messages are fetched only when navigating into a thread. I applied the same behavior in the app to ensure consistent pagination and prevent message loading from getting stuck.
Issue(s)
https://rocketchat.atlassian.net/browse/CORE-1701
How to test or reproduce
Expected Behaviour
It should load previous messages
Actual Behaviour
It just stuck on top
Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.