From 736f0e95ed52e775679c1a781cf8a1cf1c2154bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcell=20F=C3=BCl=C3=B6p?= Date: Sun, 26 Jun 2022 17:25:08 +0000 Subject: [PATCH] :adhesive_bandage: Stop status-check when Item is destroyed --- src/components/LinkItems/Item.vue | 6 +++++- src/mixins/ItemMixin.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vue index 75cf3563..24df237e 100644 --- a/src/components/LinkItems/Item.vue +++ b/src/components/LinkItems/Item.vue @@ -175,9 +175,13 @@ export default { if (this.enableStatusCheck) this.checkWebsiteStatus(); // If continious status checking is enabled, then start ever-lasting loop if (this.statusCheckInterval > 0) { - setInterval(this.checkWebsiteStatus, this.statusCheckInterval * 1000); + this.intervalId = setInterval(this.checkWebsiteStatus, this.statusCheckInterval * 1000); } }, + beforeDestroy() { + // Stop periodic status-check when item is destroyed (e.g. navigating in multi-page setup) + if (this.intervalId) clearInterval(this.intervalId); + }, }; diff --git a/src/mixins/ItemMixin.js b/src/mixins/ItemMixin.js index 47148c4c..83113752 100644 --- a/src/mixins/ItemMixin.js +++ b/src/mixins/ItemMixin.js @@ -22,6 +22,7 @@ export default { return { statusResponse: undefined, contextMenuOpen: false, + intervalId: undefined, // status-check setInterval() id contextPos: { posX: undefined, posY: undefined,