Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix: clear all intervals before destroying components
Browse files Browse the repository at this point in the history
  • Loading branch information
vhf committed Feb 11, 2020
1 parent 3a1d55d commit 096d6ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
9 changes: 7 additions & 2 deletions pages/install/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ export default {
}
this.rebooting = true
setTimeout(() => {
const checker = setInterval(async () => {
this.checker = setInterval(async () => {
if (this.checkInProgress) {
return
}
if (await this.isUp()) {
clearInterval(checker)
clearInterval(this.checker)
setTimeout(() => {
window.location.href = `${this.protocol}://${this.host}/install`
}, 10 * 1000)
Expand All @@ -200,6 +200,11 @@ export default {
}, 1000)
}
},
beforeDestroy () {
if (this.checker) {
clearInterval(this.checker)
}
},
head () {
const h = {
title: this.$headTitle('Ontology Manager Installation')
Expand Down
9 changes: 7 additions & 2 deletions pages/proposal/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ export default {
message: 'Not found'
})
}
const waitForAuth = setInterval(() => {
this.waitForAuth = setInterval(() => {
if (!this.$store.state.authProcessDone) {
return
}
clearInterval(waitForAuth)
clearInterval(this.waitForAuth)
loader(this.id)
.then((isDraft) => {
Expand All @@ -288,6 +288,11 @@ export default {
}, 200)
}
},
beforeDestroy () {
if (this.waitForAuth) {
clearInterval(this.waitForAuth)
}
},
validate ({ params }) {
// Must be a number
return /^\d+$/.test(params.id)
Expand Down
9 changes: 5 additions & 4 deletions pages/proposal/property.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ export default {
}
// if we have an ID from the URL here, we load
else if (this.isEditingExistingDraft) {
const waitForAuth = setInterval(() => {
this.waitForAuth = setInterval(() => {
if (!this.$store.state.authProcessDone || typeof this.prop === 'undefined') {
return
}
clearInterval(waitForAuth)
clearInterval(this.waitForAuth)
this.load(this.id)
.then((isDraft) => {
this.storeReady = true
Expand Down Expand Up @@ -248,9 +248,10 @@ export default {
this.storeReady = true
}
},
beforeDestroy () {
async beforeDestroy () {
clearInterval(this.waitForAuth)
if (this.saveInterval) {
this.saveDraft()
await this.saveDraft()
this.stopAutosave()
}
},
Expand Down

0 comments on commit 096d6ad

Please sign in to comment.