Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions app/lib/methods/loadMessagesForRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import updateMessages from './updateMessages';
import { generateLoadMoreId } from './helpers/generateLoadMoreId';

const COUNT = 50;
const COUNT_LIMIT = COUNT * 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Simulator Screenshot - iPhone 16 - 2025-12-22 at 19 36 54 Simulator Screenshot - iPhone 16 - 2025-12-22 at 19 35 38

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.


async function load({ rid: roomId, latest, t }: { rid: string; latest?: Date; t: RoomTypes }): Promise<IMessage[]> {
const apiType = roomTypeToApiType(t);
Expand All @@ -21,7 +20,7 @@ async function load({ rid: roomId, latest, t }: { rid: string; latest?: Date; t:
let mainMessagesCount = 0;

async function fetchBatch(lastTs?: string): Promise<void> {
if (allMessages.length >= COUNT_LIMIT) {
if (allMessages.length >= COUNT) {
return;
}

Expand Down Expand Up @@ -77,7 +76,7 @@ export function loadMessagesForRoom(args: {
if (data?.length) {
const lastMessage = data[data.length - 1];
const lastMessageRecord = await getMessageById(lastMessage._id as string);
if (!lastMessageRecord && (data.length === COUNT || data.length >= COUNT_LIMIT)) {
if (!lastMessageRecord && data.length === COUNT) {
const loadMoreMessage = {
_id: generateLoadMoreId(lastMessage._id as string),
rid: lastMessage.rid,
Expand Down
Loading