Fix loading newer messages on scroll
This commit is contained in:
parent
c901708281
commit
187d80066e
2 changed files with 5 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue