diff --git a/dashboard/src/components/LogsViewer.vue b/dashboard/src/components/LogsViewer.vue index 17d9a7e32..00916bb78 100644 --- a/dashboard/src/components/LogsViewer.vue +++ b/dashboard/src/components/LogsViewer.vue @@ -119,12 +119,12 @@ export default { let newLogLines = []; const tmp = document.getElementsByClassName('pankow-main-layout-body')[0]; - setInterval(() => { + this.refreshInterval = setInterval(() => { newLogLines = newLogLines.slice(-maxLines); for (const line of newLogLines) { if (lines < maxLines) ++lines; - else this.$refs.linesContainer.removeChild(this.$refs.linesContainer.firstChild); + else if (this.$refs.linesContainer.firstChild) this.$refs.linesContainer.removeChild(this.$refs.linesContainer.firstChild); const logLine = document.createElement('div'); logLine.className = 'log-line'; @@ -143,6 +143,9 @@ export default { }, function (error) { newLogLines.push({ time: error.time, html: error.html }); }); + }, + unmounted() { + clearInterval(this.refreshInterval); } };