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

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


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new 6282eb2b306 [v3-1-test] Fix table filters reseting when deleting a dag 
(#60279) (#60287)
6282eb2b306 is described below

commit 6282eb2b3065ac753d69c1a46316f54a455e1f06
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jan 8 15:47:31 2026 -0500

    [v3-1-test] Fix table filters reseting when deleting a dag (#60279) (#60287)
    
    (cherry picked from commit 4601fa27f60e0c4d0f114951bf46ce7643709640)
    
    Co-authored-by: Pierre Jeambrun <[email protected]>
---
 .../airflow/ui/src/components/DagActions/DeleteDagButton.tsx   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/airflow-core/src/airflow/ui/src/components/DagActions/DeleteDagButton.tsx 
b/airflow-core/src/airflow/ui/src/components/DagActions/DeleteDagButton.tsx
index 59304f35afe..c3a73ccd096 100644
--- a/airflow-core/src/airflow/ui/src/components/DagActions/DeleteDagButton.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DagActions/DeleteDagButton.tsx
@@ -19,7 +19,7 @@
 import { Box, type ButtonProps, useDisclosure } from "@chakra-ui/react";
 import { useTranslation } from "react-i18next";
 import { FiTrash2 } from "react-icons/fi";
-import { useNavigate } from "react-router-dom";
+import { useLocation, useNavigate } from "react-router-dom";
 
 import DeleteDialog from "src/components/DeleteDialog";
 import ActionButton from "src/components/ui/ActionButton";
@@ -34,12 +34,18 @@ type DeleteDagButtonProps = {
 const DeleteDagButton = ({ dagDisplayName, dagId, width, withText = true }: 
DeleteDagButtonProps) => {
   const { onClose, onOpen, open } = useDisclosure();
   const navigate = useNavigate();
+  const location = useLocation();
   const { t: translate } = useTranslation("dags");
+
+  const isOnDagDetailPage = location.pathname.includes(`/dags/${dagId}`);
+
   const { isPending, mutate: deleteDag } = useDeleteDag({
     dagId,
     onSuccessConfirm: () => {
       onClose();
-      navigate("/dags");
+      if (isOnDagDetailPage) {
+        navigate("/dags");
+      }
     },
   });
 

Reply via email to