Fix loading newer messages on scroll

This commit is contained in:
Fedor Indutny 2024-08-22 11:37:34 -07:00 committed by GitHub
parent c901708281
commit 187d80066e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -1561,6 +1561,7 @@ export class ConversationModel extends window.Backbone
});
let messages: ReadonlyArray<MessageAttributesType>;
let unboundedFetch = true;
if (metrics.oldestUnseen) {
const unseen = await getMessageById(metrics.oldestUnseen.id);
if (!unseen) {
@ -1587,6 +1588,7 @@ export class ConversationModel extends window.Backbone
messages = [...older, unseen, ...newer];
metrics = freshMetrics;
unboundedFetch = false;
} else {
messages = await getOlderMessagesByConversation({
conversationId: this.id,
@ -1607,6 +1609,7 @@ export class ConversationModel extends window.Backbone
conversationId: this.id,
messages: cleaned,
metrics,
unboundedFetch,
});
} finally {
finish();

View file

@ -439,6 +439,7 @@ export type ConversationPreloadDataType = ReadonlyDeep<{
conversationId: string;
messages: ReadonlyArray<ReadonlyMessageAttributesType>;
metrics: MessageMetricsType;
unboundedFetch: boolean;
}>;
export type MessagesByConversationType = ReadonlyDeep<{
@ -5672,10 +5673,7 @@ export function reducer(
return dropPreloadData(state);
}
return updateMessageLookup(state, {
...preloadData,
unboundedFetch: true,
});
return updateMessageLookup(state, preloadData);
}
if (action.type === 'SET_MESSAGE_LOADING_STATE') {
const { payload } = action;