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

bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 22f91a51424 AIP-38 Fix Graph not updating (#44702)
22f91a51424 is described below

commit 22f91a51424f2dd42a3cec7161366e56023c3826
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Fri Dec 6 03:27:10 2024 +0800

    AIP-38 Fix Graph not updating (#44702)
---
 airflow/ui/src/pages/DagsList/Dag/Graph/Graph.tsx         | 1 +
 airflow/ui/src/pages/DagsList/Dag/Graph/useGraphLayout.ts | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/airflow/ui/src/pages/DagsList/Dag/Graph/Graph.tsx 
b/airflow/ui/src/pages/DagsList/Dag/Graph/Graph.tsx
index 84fbc2be114..69ee51cc892 100644
--- a/airflow/ui/src/pages/DagsList/Dag/Graph/Graph.tsx
+++ b/airflow/ui/src/pages/DagsList/Dag/Graph/Graph.tsx
@@ -48,6 +48,7 @@ export const Graph = ({ dagId }: { readonly dagId: 
DAGResponse["dag_id"] }) => {
 
   const { data } = useGraphLayout({
     ...graphData,
+    dagId,
     openGroupIds,
   });
 
diff --git a/airflow/ui/src/pages/DagsList/Dag/Graph/useGraphLayout.ts 
b/airflow/ui/src/pages/DagsList/Dag/Graph/useGraphLayout.ts
index 3cdb6423db7..2cd9bae37b4 100644
--- a/airflow/ui/src/pages/DagsList/Dag/Graph/useGraphLayout.ts
+++ b/airflow/ui/src/pages/DagsList/Dag/Graph/useGraphLayout.ts
@@ -20,6 +20,7 @@ import { useQuery } from "@tanstack/react-query";
 import ELK, { type ElkNode, type ElkExtendedEdge, type ElkShape } from "elkjs";
 
 import type {
+  DAGResponse,
   EdgeResponse,
   NodeResponse,
   StructureDataResponse,
@@ -247,11 +248,13 @@ const generateElkGraph = ({
 };
 
 type LayoutProps = {
+  dagId: DAGResponse["dag_id"];
   openGroupIds: Array<string>;
 } & StructureDataResponse;
 
 export const useGraphLayout = ({
   arrange = "LR",
+  dagId,
   edges,
   nodes,
   openGroupIds = [],
@@ -290,5 +293,5 @@ export const useGraphLayout = ({
 
       return { edges: formattedEdges, nodes: flattenedData.nodes };
     },
-    queryKey: ["graphLayout", nodes.length, openGroupIds, arrange],
+    queryKey: ["graphLayout", nodes.length, openGroupIds, arrange, dagId],
   });

Reply via email to