From b9a834473eca6f56951fa8228f410d72aa140ea4 Mon Sep 17 00:00:00 2001 From: minemalox <55745413+minemalox@users.noreply.github.com> Date: Sun, 7 Jul 2024 20:39:19 +0200 Subject: [PATCH] fix(system-resources/chat): scroll to bottom and show chat on new message --- .../resources/chat/html/App.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/ext/system-resources/resources/chat/html/App.ts b/ext/system-resources/resources/chat/html/App.ts index ab0545b5ee..a9a1acdaee 100644 --- a/ext/system-resources/resources/chat/html/App.ts +++ b/ext/system-resources/resources/chat/html/App.ts @@ -115,19 +115,22 @@ export default defineComponent({ window.addEventListener("message", this.listener); }, watch: { - messages() { - if (this.hideState !== ChatHideStates.AlwaysHide) { - if (this.showWindowTimer) { - clearTimeout(this.showWindowTimer); + messages: { + handler() { + if (this.hideState !== ChatHideStates.AlwaysHide) { + if (this.showWindowTimer) { + clearTimeout(this.showWindowTimer); + } + this.showWindow = true; + this.resetShowWindowTimer(); } - this.showWindow = true; - this.resetShowWindowTimer(); - } - const messagesObj = this.$refs.messages as HTMLDivElement; - this.$nextTick(() => { - messagesObj.scrollTop = messagesObj.scrollHeight; - }); + const messagesObj = this.$refs.messages as HTMLDivElement; + this.$nextTick(() => { + messagesObj.scrollTop = messagesObj.scrollHeight; + }); + }, + deep: true } }, computed: {