From 4e76d707b155aeb0d60a6c4d31f07e1ed3c8ad92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Midb=C3=B8e?= Date: Fri, 20 Mar 2020 14:29:23 +0100 Subject: [PATCH] Only handle if ref exists --- src/ui/Attendees.vue | 8 +++++--- src/ui/Chat.vue | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ui/Attendees.vue b/src/ui/Attendees.vue index 059f4b1..ccc2b43 100644 --- a/src/ui/Attendees.vue +++ b/src/ui/Attendees.vue @@ -24,9 +24,11 @@ export default { attendees: { deep: true, handler() { - setTimeout(() => { - this.$refs.attendees.scrollTop = this.$refs.attendees.scrollHeight; - }, 50); + if (this.$refs && this.$refs.history) { + setTimeout(() => { + this.$refs.attendees.scrollTop = this.$refs.attendees.scrollHeight; + }, 50); + } } } } diff --git a/src/ui/Chat.vue b/src/ui/Chat.vue index d104290..e66ee08 100644 --- a/src/ui/Chat.vue +++ b/src/ui/Chat.vue @@ -53,9 +53,11 @@ export default { watch: { chatHistory: { handler() { - setTimeout(() => { - this.$refs.history.scrollTop = this.$refs.history.scrollHeight; - }, 10); + if (this.$refs && this.$refs.history) { + setTimeout(() => { + this.$refs.history.scrollTop = this.$refs.history.scrollHeight; + }, 10); + } }, deep: true }