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


##########
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:
   Let's check that allGroupIds != observedGroupIds. That would be a better if 
statement



-- 
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