diff --git a/client/src/components/Tool/ToolForm.vue b/client/src/components/Tool/ToolForm.vue index 72708e82dad..03e21c391da 100644 --- a/client/src/components/Tool/ToolForm.vue +++ b/client/src/components/Tool/ToolForm.vue @@ -165,12 +165,22 @@ export default { }; }, created() { - this.requestTool(); + this.requestTool().then(() => { + const Galaxy = getGalaxyInstance(); + if (Galaxy && Galaxy.currHistoryPanel) { + console.debug("ToolForm::created - Listening to history changes."); + Galaxy.currHistoryPanel.collection.on("change", () => { + this.onUpdate(); + console.debug("ToolForm::created - Loading history changes."); + }); + } + }); + }, + beforeDestroy() { const Galaxy = getGalaxyInstance(); if (Galaxy && Galaxy.currHistoryPanel) { - Galaxy.currHistoryPanel.collection.on("change", () => { - this.onUpdate(); - }); + Galaxy.currHistoryPanel.collection.off("change"); + console.debug("ToolForm::beforeDestroy - Stopped listening to history changes."); } }, computed: { @@ -227,7 +237,7 @@ export default { }, requestTool(newVersion) { this.currentVersion = newVersion || this.currentVersion; - getToolFormData(this.id, this.currentVersion, this.job_id, this.history_id).then((data) => { + return getToolFormData(this.id, this.currentVersion, this.job_id, this.history_id).then((data) => { this.formConfig = data; this.remapAllowed = this.job_id && data.job_remap; this.showLoading = false; diff --git a/client/src/entry/analysis/AnalysisRouter.js b/client/src/entry/analysis/AnalysisRouter.js index 757c95ae850..d6218eda677 100644 --- a/client/src/entry/analysis/AnalysisRouter.js +++ b/client/src/entry/analysis/AnalysisRouter.js @@ -125,7 +125,11 @@ export const getAnalysisRouter = (Galaxy) => { } this.page.display(container, noPadding); const mountFn = mountVueComponent(component); - return mountFn(propsData, container); + if (this.currentComponent && this.currentComponent.$destroy) { + this.currentComponent.$destroy(); + } + this.currentComponent = mountFn(propsData, container); + return this.currentComponent; }, show_tours: function (tour_id) {