From 034d75a9b85e705caf3c9bae2c4057fbf0757235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 19 May 2022 14:06:50 +0200 Subject: [PATCH] Web: prevent error when notification popover is empty --- web/app/src/components/FooterPopup.vue | 1 + web/app/src/stores/notifications.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/web/app/src/components/FooterPopup.vue b/web/app/src/components/FooterPopup.vue index 863326f5..57cf6651 100644 --- a/web/app/src/components/FooterPopup.vue +++ b/web/app/src/components/FooterPopup.vue @@ -46,6 +46,7 @@ onMounted(() => { }); function _scrollToBottom() { + if (notifs.empty) return; tabulator.scrollToRow(notifs.lastID, "bottom", false); } function _subscribeToPinia() { diff --git a/web/app/src/stores/notifications.js b/web/app/src/stores/notifications.js index 9b10d09d..e6f41196 100644 --- a/web/app/src/stores/notifications.js +++ b/web/app/src/stores/notifications.js @@ -22,6 +22,9 @@ export const useNotifs = defineStore('notifications', { hideTimerID: 0, lastID: 0, }), + getters: { + empty: (state) => state.history.length == 0, + }, actions: { /** * Add a simple notification.