pierrejeambrun commented on code in PR #55012:
URL: https://github.com/apache/airflow/pull/55012#discussion_r2315909451


##########
airflow-core/src/airflow/ui/src/components/Graph/DownloadButton.tsx:
##########
@@ -26,24 +26,28 @@ import { toaster } from "src/components/ui";
 
 export const DownloadButton = ({ name }: { readonly name: string }) => {
   const { t: translate } = useTranslation("components");
-  const { getNodes, getZoom } = useReactFlow();
 
-  const onClick = () => {
-    const nodesBounds = getNodesBounds(getNodes());
+  const { fitView } = useReactFlow();
+
+  const onClick = async () => {
+
+    // Ensure the graph fits before taking screenshot
+    fitView({ duration: 0, padding: 0.1 });
+
+    // Small delay to let layout stabilize
+    await new Promise((resolve) => setTimeout(resolve, 50));

Review Comment:
   This is really not great. I don't think we need that. `fitView` should 
return a promise, and we can await that to be sure that we move forward once 
the graph fits.



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