Scroll to bottom of conversation when message is sent
This commit is contained in:
@@ -594,7 +594,14 @@ export class Timeline extends React.Component<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldItems.length !== newItems.length) {
|
// We know that all items will be in order and that items can only be added at either
|
||||||
|
// end, so we can check for equality without checking each item in the array
|
||||||
|
const haveItemsChanged =
|
||||||
|
oldItems.length !== newItems.length ||
|
||||||
|
oldItems.at(0) !== newItems.at(0) ||
|
||||||
|
oldItems.at(-1) !== newItems.at(-1);
|
||||||
|
|
||||||
|
if (haveItemsChanged) {
|
||||||
this.updateIntersectionObserver();
|
this.updateIntersectionObserver();
|
||||||
|
|
||||||
// This condition is somewhat arbitrary.
|
// This condition is somewhat arbitrary.
|
||||||
|
@@ -1436,7 +1436,10 @@ export class ConversationModel extends window.Backbone
|
|||||||
newestId && messageIds && messageIds[messageIds.length - 1] === newestId;
|
newestId && messageIds && messageIds[messageIds.length - 1] === newestId;
|
||||||
|
|
||||||
if (isJustSent && existingConversation && !isLatestInMemory) {
|
if (isJustSent && existingConversation && !isLatestInMemory) {
|
||||||
void this.loadNewestMessages(undefined, undefined);
|
// The message is being sent before the user has scrolled down to load the newest
|
||||||
|
// messages into memory; in that case, we scroll the user all the way down by
|
||||||
|
// loading the newest message
|
||||||
|
drop(this.loadNewestMessages(newestId, undefined));
|
||||||
} else if (
|
} else if (
|
||||||
// The message has to be not a story or has to be a story reply in direct
|
// The message has to be not a story or has to be a story reply in direct
|
||||||
// conversation.
|
// conversation.
|
||||||
|
Reference in New Issue
Block a user