scroll down when switching chat

This commit is contained in:
Phillip Lang Martinez 2022-12-09 22:45:19 -05:00
parent f980196988
commit 3105fbde13
3 changed files with 9 additions and 2 deletions

View File

@ -876,6 +876,7 @@ class ChatPage extends LitElement {
renderChatScroller() { renderChatScroller() {
return html` return html`
<chat-scroller <chat-scroller
chatId=${this.chatId}
.messages=${this.messagesRendered} .messages=${this.messagesRendered}
.escapeHTML=${escape} .escapeHTML=${escape}
.getOldMessage=${this.getOldMessage} .getOldMessage=${this.getOldMessage}

View File

@ -33,7 +33,8 @@ class ChatScroller extends LitElement {
showLastMessageRefScroller: { type: Function }, showLastMessageRefScroller: { type: Function },
emojiPicker: { attribute: false }, emojiPicker: { attribute: false },
isLoadingMessages: { type: Boolean}, isLoadingMessages: { type: Boolean},
setIsLoadingMessages: {attribute: false} setIsLoadingMessages: {attribute: false},
chatId: { type: String }
} }
} }
@ -112,6 +113,9 @@ class ChatScroller extends LitElement {
if(changedProperties.has('isLoadingMessages')){ if(changedProperties.has('isLoadingMessages')){
return true return true
} }
if(changedProperties.has('chatId') && changedProperties.get('chatId')){
return true
}
// Only update element if prop1 changed. // Only update element if prop1 changed.
return changedProperties.has('messages'); return changedProperties.has('messages');
} }

View File

@ -330,7 +330,9 @@ class Chat extends LitElement {
} }
setActiveChatHeadUrl(url){ async setActiveChatHeadUrl(url){
this.activeChatHeadUrl = ''
await this.updateComplete;
this.activeChatHeadUrl = url this.activeChatHeadUrl = url
} }