diff --git a/client/web/compose/src/components/PageBlocks/AutomationBase.vue b/client/web/compose/src/components/PageBlocks/AutomationBase.vue index dfa044fe0..1f5723d62 100644 --- a/client/web/compose/src/components/PageBlocks/AutomationBase.vue +++ b/client/web/compose/src/components/PageBlocks/AutomationBase.vue @@ -40,6 +40,8 @@ export default { processing: false, automationScripts: [], + + abortRequests: [], } }, @@ -49,19 +51,37 @@ export default { }, }, + beforeDestroy () { + this.abortRequests.forEach((cancel) => { + cancel() + }) + }, + created () { if (this.$UIHooks.set && !!this.$UIHooks.set.length) { return } - this.processing = true - return this.$ComposeAPI.automationList({ eventTypes: ['onManual'], excludeInvalid: true }) - .then(({ set = [] }) => { - this.automationScripts = set - }) - .finally(() => { - this.processing = false - }) + this.fetchAutomationLists() + }, + + methods: { + fetchAutomationLists () { + this.processing = true + + const { response, cancel } = this.$ComposeAPI + .automationListCancellable({ eventTypes: ['onManual'], excludeInvalid: true }) + + this.abortRequests.push(cancel) + + return response() + .then(({ set = [] }) => { + this.automationScripts = set + }) + .finally(() => { + this.processing = false + }) + }, }, beforeDestroy () { diff --git a/client/web/compose/src/components/PageBlocks/CalendarBase.vue b/client/web/compose/src/components/PageBlocks/CalendarBase.vue index 9c9fc6c1c..e7cc0efd3 100644 --- a/client/web/compose/src/components/PageBlocks/CalendarBase.vue +++ b/client/web/compose/src/components/PageBlocks/CalendarBase.vue @@ -102,6 +102,7 @@ diff --git a/client/web/compose/src/components/PageBlocks/CommentBase.vue b/client/web/compose/src/components/PageBlocks/CommentBase.vue index 9678b6d09..f382cd100 100644 --- a/client/web/compose/src/components/PageBlocks/CommentBase.vue +++ b/client/web/compose/src/components/PageBlocks/CommentBase.vue @@ -123,6 +123,8 @@ export default { title: '', content: '', }, + + abortRequests: [], } }, @@ -217,6 +219,10 @@ export default { beforeDestroy () { this.setDefaultValues() + + this.abortRequests.forEach((cancel) => { + cancel() + }) }, methods: { @@ -338,8 +344,11 @@ export default { sort, } - return this.$ComposeAPI - .recordList(params) + const { response, cancel } = this.$ComposeAPI + .recordListCancellable(params) + this.abortRequests.push(cancel) + + return response() .then(({ set }) => set.map(r => Object.freeze(new compose.Record(module, r)))) }, diff --git a/client/web/compose/src/components/PageBlocks/GeometryBase.vue b/client/web/compose/src/components/PageBlocks/GeometryBase.vue index 9963aca53..21cf6d2c2 100644 --- a/client/web/compose/src/components/PageBlocks/GeometryBase.vue +++ b/client/web/compose/src/components/PageBlocks/GeometryBase.vue @@ -65,6 +65,7 @@ diff --git a/client/web/compose/src/components/PageBlocks/MetricBase.vue b/client/web/compose/src/components/PageBlocks/MetricBase.vue index c279c518a..15bd3cb58 100644 --- a/client/web/compose/src/components/PageBlocks/MetricBase.vue +++ b/client/web/compose/src/components/PageBlocks/MetricBase.vue @@ -66,6 +66,8 @@ export default { return { processing: false, reports: [], + + abortRequests: [], } }, @@ -94,6 +96,12 @@ export default { beforeDestroy () { this.setDefaultValues() this.destroyEvents() + this.$root.$off('metric.update', this.refresh) + this.$root.$off(`refetch-non-record-blocks:${this.page.pageID}`) + + this.abortRequests.forEach((cancel) => { + cancel() + }) }, created () { @@ -135,7 +143,14 @@ export default { try { const rtr = [] const namespaceID = this.namespace.namespaceID - const reporter = r => this.$ComposeAPI.recordReport({ ...r, namespaceID }) + const reporter = r => { + const { response, cancel } = this.$ComposeAPI + .recordReportCancellable({ ...r, namespaceID }) + + this.abortRequests.push(cancel) + + return response() + } for (const m of this.options.metrics) { if (m.moduleID) { diff --git a/client/web/compose/src/components/PageBlocks/RecordBase.vue b/client/web/compose/src/components/PageBlocks/RecordBase.vue index 466bd278c..c1e1e263b 100644 --- a/client/web/compose/src/components/PageBlocks/RecordBase.vue +++ b/client/web/compose/src/components/PageBlocks/RecordBase.vue @@ -101,6 +101,7 @@