Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Smooth fade-in animation for workflow editor blocks and edges (#SKY-8060) (#4912)
Celal Zamanoğlu988c50d049db
diff --git a/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx b/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsxindex 18ec02dc5..e864763ff 100644--- a/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/FlowRenderer.tsx@@ -8,6 +8,7 @@ import {DialogTitle,} from "@/components/ui/dialog";import { useOnChange } from "@/hooks/useOnChange";+import { cn } from "@/util/utils";import { useShouldNotifyWhenClosingTab } from "@/hooks/useShouldNotifyWhenClosingTab";import { BlockActionContext } from "@/store/BlockActionContext";import { useDebugStore } from "@/store/useDebugStore";@@ -318,6 +319,17 @@ function FlowRenderer({const parameters = useWorkflowParametersStore((state) => state.parameters);const nodesInitialized = useNodesInitialized();const [shouldConstrainPan, setShouldConstrainPan] = useState(false);++ // Track layout phase for animation control:+ // "pre-layout" = nodes hidden while Dagre hasn't computed positions yet+ // "initial-load" = nodes fading in at their final positions (no position transition)+ // "ready" = normal operation with position transitions enabled+ // The 350ms timeout is coupled with the CSS fade-in duration (300ms) in reactFlowOverrideStyles.css+ const [layoutPhase, setLayoutPhase] = useState<+ "pre-layout" | "initial-load" | "ready"+ >("pre-layout");+ const hasCompletedInitialLoad = useRef(false);+ const fadeTimerRef = useRef<ReturnType<typeof setTimeout>>();const flowIsConstrained = debugStore.isDebugMode;// Track if this is the initial load to prevent false "unsaved changes" detection@@ -391,8 +403,22 @@ function FlowRenderer({);useEffect(() => {- if (nodesInitialized) {+ if (nodesInitialized && !hasCompletedInitialLoad.current) {+ hasCompletedInitialLoad.current = true;doLayout(nodes, edges);+ // After Dagre computes positions, wait one frame for the DOM to update+ // with new positions, then fade in the nodes/edges at their final positions.+ const rafId = requestAnimationFrame(() => {+ setLayoutPhase("initial-load");+ // After the fade-in animation completes, enable normal transform transitions+ fadeTimerRef.current = setTimeout(() => {+ setLayoutPhase("ready");+ }, 350);+ });+ return () => {+ cancelAnimationFrame(rafId);+ if (fadeTimerRef.current) clearTimeout(fadeTimerRef.current);+ };}// eslint-disable-next-line react-hooks/exhaustive-deps}, [nodesInitialized]);@@ -834,7 +860,11 @@ function FlowRenderer({return (<div- className="h-full w-full"+ className={cn("h-full w-full", {+ "react-flow--pre-layout": layoutPhase === "pre-layout",+ "react-flow--initial-load":+ layoutPhase === "initial-load" || layoutPhase === "pre-layout",+ })}style={{ zIndex }}onMouseDownCapture={() => onMouseDownCapture?.()}>@@ -916,10 +946,11 @@ function FlowRenderer({node.measured?.height !== newHeight) {hasActualChanges = true;- if (node.measured) {- node.measured.width = newWidth;- node.measured.height = newHeight;- }+ node.measured = {+ ...node.measured,+ width: newWidth,+ height: newHeight,+ };}}});diff --git a/skyvern-frontend/src/routes/workflows/editor/reactFlowOverrideStyles.css b/skyvern-frontend/src/routes/workflows/editor/reactFlowOverrideStyles.cssindex 6a6ef7cf2..c5b1ac189 100644--- a/skyvern-frontend/src/routes/workflows/editor/reactFlowOverrideStyles.css+++ b/skyvern-frontend/src/routes/workflows/editor/reactFlowOverrideStyles.css@@ -30,6 +30,45 @@transition: transform 0.2s ease-out;}+/*+ * Initial load animation phases:+ * 1. "pre-layout" - nodes/edges are hidden (opacity: 0) while Dagre computes positions+ * 2. "initial-load" - nodes/edges fade in at their final positions (opacity transition only)+ * 3. "ready" (no class) - normal operation with position transitions+ *+ * The fade-in duration (300ms) is coupled with the setTimeout in FlowRenderer.tsx (350ms).+ */++/* Before layout completes, hide everything */+.react-flow--pre-layout .react-flow__node {+ opacity: 0;+}++.react-flow--pre-layout .react-flow__edge path,+.react-flow--pre-layout .react-flow__edge-path {+ opacity: 0;+}++.react-flow--pre-layout .react-flow__edge text,+.react-flow--pre-layout .react-flow__edge-text {+ opacity: 0;+}++/* During initial load, override position transitions with opacity fade-in */+.react-flow--initial-load .react-flow__node {+ transition: opacity 0.3s ease-in;+}++.react-flow--initial-load .react-flow__edge path,+.react-flow--initial-load .react-flow__edge-path {+ transition: opacity 0.3s ease-in;+}++.react-flow--initial-load .react-flow__edge text,+.react-flow--initial-load .react-flow__edge-text {+ transition: opacity 0.3s ease-in;+}+.react-flow__handle-top {top: 3px;}