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

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


The following commit(s) were added to refs/heads/v3-3-test by this push:
     new f006f9d537c [v3-3-test] Reset task try when switching Graph tasks 
(#70780) (#70817)
f006f9d537c is described below

commit f006f9d537c5953fa30e08a1f0513f8961acadb2
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jul 31 17:18:42 2026 +0530

    [v3-3-test] Reset task try when switching Graph tasks (#70780) (#70817)
    
    (cherry picked from commit 745b1de10279c90248a08f8b985ee0c776382041)
    
    Co-authored-by: Andrew Chang <[email protected]>
---
 .../ui/src/components/Graph/TaskLink.test.tsx      | 49 ++++++++++++++++++++++
 .../airflow/ui/src/components/Graph/TaskLink.tsx   |  7 +++-
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.test.tsx 
b/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.test.tsx
new file mode 100644
index 00000000000..0332c129dfb
--- /dev/null
+++ b/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.test.tsx
@@ -0,0 +1,49 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import "@testing-library/jest-dom";
+import { render, screen } from "@testing-library/react";
+import { MemoryRouter, Route, Routes } from "react-router-dom";
+import { describe, expect, it } from "vitest";
+
+import { BaseWrapper } from "src/utils/Wrapper";
+
+import { TaskLink } from "./TaskLink";
+
+describe("TaskLink", () => {
+  it("removes the selected try when linking to another task", () => {
+    render(
+      <MemoryRouter
+        
initialEntries={["/dags/test_dag/runs/test_run/tasks/three_tries?try_number=2&log_level=error"]}
+      >
+        <Routes>
+          <Route
+            element={<TaskLink id="one_try" label="one_try" />}
+            path="/dags/:dagId/runs/:runId/tasks/:taskId"
+          />
+        </Routes>
+      </MemoryRouter>,
+      { wrapper: BaseWrapper },
+    );
+
+    expect(screen.getByRole("link", { name: "one_try" })).toHaveAttribute(
+      "href",
+      "/dags/test_dag/runs/test_run/tasks/one_try?log_level=error",
+    );
+  });
+});
diff --git a/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.tsx 
b/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.tsx
index fb96238601f..5ec36b34c24 100644
--- a/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.tsx
+++ b/airflow-core/src/airflow/ui/src/components/Graph/TaskLink.tsx
@@ -20,6 +20,7 @@ import { forwardRef } from "react";
 import { useParams, useSearchParams, Link as RouterLink } from 
"react-router-dom";
 
 import { TaskName, type TaskNameProps } from "src/components/TaskName";
+import { SearchParamsKeys } from "src/constants/searchParams";
 import { taskNodeSeparator } from "src/utils/assetGraph";
 
 type Props = {
@@ -55,8 +56,12 @@ export const TaskLink = forwardRef<HTMLAnchorElement, 
Props>(({ id, isGroup, isM
       ? ""
       : `/tasks/${taskId}${isMapped && urlTaskId !== taskId && runId !== 
undefined ? "/mapped" : ""}`;
 
+  const targetSearchParams = new URLSearchParams(searchParams);
+
+  targetSearchParams.delete(SearchParamsKeys.TRY_NUMBER);
+
   return (
-    <RouterLink ref={ref} to={{ pathname: basePath + taskPath, search: 
searchParams.toString() }}>
+    <RouterLink ref={ref} to={{ pathname: basePath + taskPath, search: 
targetSearchParams.toString() }}>
       <TaskName isGroup={isGroup} isMapped={isMapped} {...rest} />
     </RouterLink>
   );

Reply via email to