bbovenzi commented on code in PR #53116:
URL: https://github.com/apache/airflow/pull/53116#discussion_r2205612338


##########
airflow-core/src/airflow/ui/src/layouts/Details/Graph/Graph.tsx:
##########
@@ -71,18 +73,32 @@ export const Graph = () => {
     "gray.800",
   ]);
 
-  const { openGroupIds } = useOpenGroups();
+  const { openGroupIds, setAllGroupIds } = useOpenGroups();
 
   const [dependencies] = useLocalStorage<"all" | "immediate" | 
"tasks">(`dependencies-${dagId}`, "tasks");
   const [direction] = useLocalStorage<Direction>(`direction-${dagId}`, 
"RIGHT");
 
   const selectedColor = colorMode === "dark" ? selectedDarkColor : 
selectedLightColor;
+  const { data: graphData = { edges: [], nodes: [] } } = 
useStructureServiceStructureData(
+    {
+      dagId,
+      externalDependencies: dependencies === "immediate",
+      versionNumber: selectedVersion,
+    },
+    undefined,
+    { enabled: selectedVersion !== undefined },
+  );
 
-  const { data: graphData = { edges: [], nodes: [] } } = 
useStructureServiceStructureData({
-    dagId,
-    externalDependencies: dependencies === "immediate",
-    versionNumber: selectedVersion,
-  });
+  const { allGroupIds: observedGroupIds } = useMemo(
+    () => flattenGraphNodes(graphData.nodes),
+    [graphData.nodes],
+  );
+
+  useEffect(() => {
+    if (observedGroupIds.length) {
+      setAllGroupIds(observedGroupIds);
+    }

Review Comment:
   Hmm. I am wondering if this is best approach.
   
   The structure service does depend on a versionNumber. A user could remove 
all task groups between versions. But we're also not checking if the 
allGroupIds needs to be updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to