From 92c39b1440f72994674fd9474ff71adb657005fa Mon Sep 17 00:00:00 2001 From: Tsering Paljor Date: Wed, 19 Nov 2025 15:53:34 +0400 Subject: [PATCH] Fix realtime bugs related to Automation (#4296) * Check if automation exists before trying to forceCreate a workflow * After deleting an automation app, only redirect to dashboard if the user is viewing a related workflow. * Add changelog --- ...re_creating_a_workflow_would_cause_a_crash_fo.json | 9 +++++++++ web-frontend/modules/automation/applicationTypes.js | 11 +++++++++-- web-frontend/modules/automation/realtime.js | 10 ++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 changelog/entries/unreleased/bug/4293_fixed_a_bug_where_creating_a_workflow_would_cause_a_crash_fo.json 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) => {