From 8263b178613be6266fb5a9695b78162094e8ae65 Mon Sep 17 00:00:00 2001 From: Tim Miller-Williams Date: Tue, 28 Apr 2020 15:21:49 +0100 Subject: [PATCH] Address warning in Vue 3 Property "unreadMarkerShown" was accessed during render but is not defined on instance --- client/components/MessageList.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/components/MessageList.vue b/client/components/MessageList.vue index 1e3e9128..092ecef2 100644 --- a/client/components/MessageList.vue +++ b/client/components/MessageList.vue @@ -63,6 +63,8 @@ import Message from "./Message.vue"; import MessageCondensed from "./MessageCondensed.vue"; import DateMarker from "./DateMarker.vue"; +let unreadMarkerShown = false; + export default { name: "MessageList", components: { @@ -183,7 +185,7 @@ export default { }); }, beforeUpdate() { - this.unreadMarkerShown = false; + unreadMarkerShown = false; }, beforeDestroy() { eventbus.off("resize", this.handleResize); @@ -205,8 +207,8 @@ export default { return new Date(previousMessage.time).getDay() !== new Date(message.time).getDay(); }, shouldDisplayUnreadMarker(id) { - if (!this.unreadMarkerShown && id > this.channel.firstUnread) { - this.unreadMarkerShown = true; + if (!unreadMarkerShown && id > this.channel.firstUnread) { + unreadMarkerShown = true; return true; }