From c9cfc2c13973dd30e4c07a569b5f649794f8a6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sun, 11 Apr 2021 22:32:42 +0200 Subject: [PATCH] Stop updating total stats on unmount --- web/frontend/src/components/Home.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/frontend/src/components/Home.vue b/web/frontend/src/components/Home.vue index 0c763f6..0bf56ae 100644 --- a/web/frontend/src/components/Home.vue +++ b/web/frontend/src/components/Home.vue @@ -65,6 +65,8 @@ export default class Home extends Vue { uniqueCountries: number; + private updaterHandle?: number; + ready = false; constructor() { @@ -120,10 +122,13 @@ export default class Home extends Vue { mounted(): void { this.updateStats(); - setInterval(() => { + this.updaterHandle = setInterval(() => { this.updateStats(); }, 5000); } + unmounted(): void { + clearInterval(this.updaterHandle); + } }