Skip to content

armgit / dashy

Public Imported from GitHub
0

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:adhesive_bandage: Stop status-check when Item is destroyed

Marcell Fülöp736f0e95ed52
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);
+ },
};
</script>
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,