look for changes in both id and stored id for better reload control

This commit is contained in:
Laila Los
2024-01-19 11:35:18 +01:00
parent 064654d927
commit 8506769a30
@@ -37,19 +37,27 @@ export default {
},
methods: {
async getEditorConfig() {
const storedWorkflowId = Query.get("id");
const workflowId = Query.get("workflow_id");
let reloadEditor = true;
// this will only be the case the first time the route updates from a new workflow
if (!this.storedWorkflowId && !this.workflowId) {
reloadEditor = false;
}
this.storedWorkflowId = Query.get("id");
this.workflowId = Query.get("workflow_id");
const params = {};
if (workflowId) {
params.workflow_id = workflowId;
} else if (storedWorkflowId) {
params.id = storedWorkflowId;
if (this.workflowId) {
params.workflow_id = this.workflowId;
} else if (this.storedWorkflowId) {
params.id = this.storedWorkflowId;
}
const previousId = this.editorConfig?.id;
this.editorConfig = await urlData({ url: "/workflow/editor", params });
if (previousId !== undefined && previousId !== this.editorConfig?.id) {
if (reloadEditor) {
this.editorReloadKey += 1;
}
},