Fix loading newer messages on scroll

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-08-22 22:55:04 -05:00 committed by GitHub
parent 91af034b28
commit c08d4e1e34
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;