From bfa00cc12dec26cdc5c7c4ef37532004ef5972f4 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Mon, 2 Aug 2021 08:03:12 +0530 Subject: [PATCH] fix: Avoid flicker while updating the view with new messages (#2730) --- .../components/widgets/conversation/MessagesView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue index 9b4de3651..3f8fda58d 100644 --- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue +++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue @@ -233,7 +233,7 @@ export default { created() { bus.$on('scrollToMessage', () => { - setTimeout(() => this.scrollToBottom(), 0); + this.$nextTick(() => this.scrollToBottom()); this.makeMessagesRead(); }); @@ -255,7 +255,7 @@ export default { this.conversationPanel = this.$el.querySelector('.conversation-panel'); this.setScrollParams(); this.conversationPanel.addEventListener('scroll', this.handleScroll); - this.scrollToBottom(); + this.$nextTick(() => this.scrollToBottom()); this.isLoadingPrevious = false; }, removeScrollListener() {