diff --git a/src/plugins/notebook/components/Notebook.vue b/src/plugins/notebook/components/Notebook.vue index 52cb66a69e..1aca812be0 100644 --- a/src/plugins/notebook/components/Notebook.vue +++ b/src/plugins/notebook/components/Notebook.vue @@ -306,14 +306,17 @@ export default { this.getSearchResults = debounce(this.getSearchResults, 500); this.syncUrlWithPageAndSection = debounce(this.syncUrlWithPageAndSection, 100); }, - async mounted() { + async created() { + this.transaction = null; + this.abortController = new AbortController(); await this.loadAnnotations(); + }, + async mounted() { this.formatSidebar(); this.setSectionAndPageFromUrl(); this.openmct.selection.on('change', this.updateSelection); - this.transaction = null; - + window.addEventListener('orientationchange', this.formatSidebar); window.addEventListener('hashchange', this.setSectionAndPageFromUrl); this.filterAndSortEntries(); @@ -321,9 +324,10 @@ export default { this.domainObject, '*', this.filterAndSortEntries - ); - }, + ); + }, beforeDestroy() { + this.abortController.abort(); if (this.unlisten) { this.unlisten(); } @@ -387,8 +391,10 @@ export default { this.lastLocalAnnotationCreation = this.domainObject.annotationLastCreated ?? 0; const foundAnnotations = await this.openmct.annotation.getAnnotations( - this.domainObject.identifier + this.domainObject.identifier, + this.abortController.signal ); + foundAnnotations.forEach((foundAnnotation) => { const targetId = Object.keys(foundAnnotation.targets)[0]; const entryId = foundAnnotation.targets[targetId].entryId; diff --git a/src/plugins/plot/MctPlot.vue b/src/plugins/plot/MctPlot.vue index c0d0e18e24..b8d936c114 100644 --- a/src/plugins/plot/MctPlot.vue +++ b/src/plugins/plot/MctPlot.vue @@ -331,6 +331,9 @@ export default { return this.pending === 0 && this.loaded; } }, + created() { + this.abortController = new AbortController(); + }, watch: { initGridLines(newGridLines) { this.gridLines = newGridLines; @@ -398,6 +401,7 @@ export default { this.loaded = true; }, beforeDestroy() { + this.abortController.abort(); this.openmct.selection.off('change', this.updateSelection); document.removeEventListener('keydown', this.handleKeyDown); document.removeEventListener('keyup', this.handleKeyUp); @@ -621,7 +625,8 @@ export default { await Promise.all( this.seriesModels.map(async (seriesModel) => { const seriesAnnotations = await this.openmct.annotation.getAnnotations( - seriesModel.model.identifier + seriesModel.model.identifier, + this.abortController.signal ); rawAnnotationsForPlot.push(...seriesAnnotations); })