Add component cleanup to analysis router's vue-helper, add cleanup to tool form's history listener

This commit is contained in:
guerler
2021-10-04 12:47:36 -04:00
parent 99c3f581b0
commit dbc4fb2b7a
2 changed files with 20 additions and 6 deletions
+15 -5
View File
@@ -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;
+5 -1
View File
@@ -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) {