diff --git a/changelog/entries/unreleased/bug/4293_fixed_a_bug_where_creating_a_workflow_would_cause_a_crash_fo.json b/changelog/entries/unreleased/bug/4293_fixed_a_bug_where_creating_a_workflow_would_cause_a_crash_fo.json new file mode 100644 index 0000000000..3ef4282ad7 --- /dev/null +++ b/changelog/entries/unreleased/bug/4293_fixed_a_bug_where_creating_a_workflow_would_cause_a_crash_fo.json @@ -0,0 +1,9 @@ +{ + "type": "bug", + "message": "Fixed a bug where creating a workflow would cause a crash for another user viewing a different app.", + "issue_origin": "github", + "issue_number": 4293, + "domain": "automation", + "bullet_points": [], + "created_at": "2025-11-19" +} \ No newline at end of file diff --git a/web-frontend/modules/automation/applicationTypes.js b/web-frontend/modules/automation/applicationTypes.js index e848f5bd34..32150d1e93 100644 --- a/web-frontend/modules/automation/applicationTypes.js +++ b/web-frontend/modules/automation/applicationTypes.js @@ -50,8 +50,15 @@ export class AutomationApplicationType extends ApplicationType { return SidebarComponentAutomation } - delete(application, { $router }) { - $router.push({ name: 'dashboard' }) + delete(application) { + const { store, router } = this.app + const workflowSelected = store.getters['automationWorkflow/getWorkflows']( + application + ).some((workflow) => workflow._.selected) + + if (workflowSelected) { + router.push({ name: 'dashboard' }) + } } async loadExtraData(automation) { diff --git a/web-frontend/modules/automation/realtime.js b/web-frontend/modules/automation/realtime.js index f188018955..60afe2cbd1 100644 --- a/web-frontend/modules/automation/realtime.js +++ b/web-frontend/modules/automation/realtime.js @@ -4,10 +4,12 @@ export const registerRealtimeEvents = (realtime) => { const automation = store.getters['application/get']( data.workflow.automation_id ) - store.dispatch('automationWorkflow/forceCreate', { - automation, - workflow: data.workflow, - }) + if (automation !== undefined) { + store.dispatch('automationWorkflow/forceCreate', { + automation, + workflow: data.workflow, + }) + } }) realtime.registerEvent('automation_workflow_deleted', ({ store }, data) => {