This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new 5fd168844f0 Only redirect on the dag detail page (#54920) (#54921)
5fd168844f0 is described below

commit 5fd168844f0ffd5e4bbda51b0336f5c8281d9a93
Author: Brent Bovenzi <[email protected]>
AuthorDate: Mon Aug 25 12:26:17 2025 -0500

    Only redirect on the dag detail page (#54920) (#54921)
---
 airflow-core/src/airflow/ui/src/queries/useTrigger.ts | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/airflow-core/src/airflow/ui/src/queries/useTrigger.ts 
b/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
index fe2b1de7f93..eb961a84a15 100644
--- a/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
+++ b/airflow-core/src/airflow/ui/src/queries/useTrigger.ts
@@ -18,7 +18,7 @@
  */
 import { useQueryClient } from "@tanstack/react-query";
 import { useState } from "react";
-import { useNavigate } from "react-router-dom";
+import { useNavigate, useParams } from "react-router-dom";
 
 import {
   UseDagRunServiceGetDagRunsKeyFn,
@@ -37,6 +37,7 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { 
dagId: string; onSucce
   const queryClient = useQueryClient();
   const [error, setError] = useState<unknown>(undefined);
   const navigate = useNavigate();
+  const { dagId: selectedDagId } = useParams();
 
   const onSuccess = async (dagRun: TriggerDagRunResponse) => {
     const queryKeys = [
@@ -57,7 +58,9 @@ export const useTrigger = ({ dagId, onSuccessConfirm }: { 
dagId: string; onSucce
     });
     onSuccessConfirm();
 
-    navigate(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
+    if (selectedDagId === dagRun.dag_id) {
+      navigate(`/dags/${dagRun.dag_id}/runs/${dagRun.dag_run_id}`);
+    }
   };
 
   const onError = (_error: unknown) => {

Reply via email to