diff --git a/docs/components/contributors.vue b/docs/components/contributors.vue index 0fd8276ac0e..2b6f43844dc 100644 --- a/docs/components/contributors.vue +++ b/docs/components/contributors.vue @@ -135,7 +135,9 @@ export default { } xhr.open('GET', url, true) - xhr.addEventListener('load', onLoad) + xhr.addEventListener('load', onLoad, { + signal: this.controller ? this.controller.signal : undefined + }) // Initiate the request xhr.send() }, @@ -248,6 +250,14 @@ export default { // Donors are people/organizations with one-time (paid) donations this.makeOcRequest(this.processDonors.bind(this), { status: 'paid' }) } + }, + + beforeDestroy() { + this.controller.abort() + }, + + created() { + this.controller = new window.AbortController() } } diff --git a/docs/components/quick-links.vue b/docs/components/quick-links.vue index 4741e038924..d696e77944d 100644 --- a/docs/components/quick-links.vue +++ b/docs/components/quick-links.vue @@ -52,10 +52,16 @@ export default { } }, created() { - this.$root.$on('docs-set-toc', toc => { + const handleDocsSetToc = toc => { this.expanded = false // Update the TOC content this.toc = toc + } + + this.$root.$on('docs-set-toc', handleDocsSetToc) + + this.$once('hook:beforeDestroy', () => { + this.$root.$off('docs-set-toc', handleDocsSetToc) }) }, mounted() { diff --git a/docs/components/toc.vue b/docs/components/toc.vue index 787e11d6956..083043fb166 100644 --- a/docs/components/toc.vue +++ b/docs/components/toc.vue @@ -57,8 +57,14 @@ export default { } }, created() { - this.$root.$on('docs-set-toc', toc => { + const handleDocsSetToc = toc => { this.toc = toc + } + + this.$root.$on('docs-set-toc', handleDocsSetToc) + + this.$once('hook:beforeDestroy', () => { + this.$root.$off('docs-set-toc', handleDocsSetToc) }) }, mounted() {