From c651f648e3ecacf1b7e3b6251361483dcc8aeb26 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Mon, 24 Jul 2023 09:34:12 +0200 Subject: [PATCH] check is MessagesList is rendered before scrolling Signed-off-by: Maksim Sukharev --- src/components/MessagesList/MessagesList.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index 58db31fe76..d0b5ce7e6f 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -945,7 +945,11 @@ export default { * Scrolls to the bottom of the list smoothly. */ smoothScrollToBottom() { - this.$nextTick(function() { + this.$nextTick(() => { + if (!this.$refs.scroller) { + return + } + if (this.isWindowVisible && (document.hasFocus() || this.isInCall)) { // scrollTo is used when the user is watching this.$refs.scroller.scrollTo({ @@ -970,7 +974,11 @@ export default { * Scrolls to the bottom of the list. */ scrollToBottom() { - this.$nextTick(function() { + this.$nextTick(() => { + if (!this.$refs.scroller) { + return + } + this.$refs.scroller.scrollTop = this.$refs.scroller.scrollHeight this.setChatScrolledToBottom(true) })