Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
conditional inside conditional (#4362)
Celal Zamanoglua3e5399de5fa
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowNodeLibraryPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowNodeLibraryPanel.tsxindex 74b478a69..fd6bbc43a 100644--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowNodeLibraryPanel.tsx+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowNodeLibraryPanel.tsx@@ -11,14 +11,6 @@ import { WorkflowBlockNode } from "../nodes";import { WorkflowBlockIcon } from "../nodes/WorkflowBlockIcon";import { AddNodeProps } from "../Workspace";import { Input } from "@/components/ui/input";-import { useNodes } from "@xyflow/react";-import { AppNode } from "../nodes";-import {- Tooltip,- TooltipContent,- TooltipProvider,- TooltipTrigger,-} from "@/components/ui/tooltip";const enableCodeBlock =import.meta.env.VITE_ENABLE_CODE_BLOCK?.toLowerCase() === "true";@@ -287,7 +279,6 @@ function WorkflowNodeLibraryPanel({onNodeClick,first,}: Props) {- const nodes = useNodes() as Array<AppNode>;const workflowPanelData = useWorkflowPanelStore((state) => state.workflowPanelState.data,);@@ -300,27 +291,6 @@ function WorkflowNodeLibraryPanel({const [search, setSearch] = useState("");const inputRef = useRef<HTMLInputElement>(null);- // Determine parent context to check if certain blocks should be disabled- const parentNode = workflowPanelData?.parent- ? nodes.find((n) => n.id === workflowPanelData.parent)- : null;- const parentType = parentNode?.type;-- // Check if a node type should be disabled based on parent context- const isBlockDisabled = (- nodeType: NonNullable<WorkflowBlockNode["type"]>,- ): { disabled: boolean; reason: string } => {- // Disable conditional inside conditional- if (nodeType === "conditional" && parentType === "conditional") {- return {- disabled: true,- reason:- "We're working on supporting nested conditionals. Soon you'll be able to use this feature!",- };- }- return { disabled: false, reason: "" };- };-useEffect(() => {// Focus the input when the panel becomes activeif (workflowPanelActive && inputRef.current) {@@ -416,17 +386,11 @@ function WorkflowNodeLibraryPanel({<div className="space-y-2">{filteredItems.length > 0 ? (filteredItems.map((item) => {- const { disabled, reason } = isBlockDisabled(item.nodeType);const itemContent = (<divkey={item.nodeType}- className={`flex items-center justify-between rounded-sm bg-slate-elevation4 p-4 ${- disabled- ? "cursor-not-allowed opacity-50"- : "cursor-pointer hover:bg-slate-elevation5"- }`}+ className={`flex items-center justify-between rounded-sm bg-slate-elevation4 p-4 ${"cursor-pointer hover:bg-slate-elevation5"}`}onClick={() => {- if (disabled) return;onNodeClick({nodeType: item.nodeType,next: workflowPanelData?.next ?? null,@@ -457,20 +421,6 @@ function WorkflowNodeLibraryPanel({</div>);- // Wrap with tooltip if disabled- if (disabled) {- return (- <TooltipProvider key={item.nodeType}>- <Tooltip>- <TooltipTrigger asChild>{itemContent}</TooltipTrigger>- <TooltipContent side="right">- <p className="max-w-xs">{reason}</p>- </TooltipContent>- </Tooltip>- </TooltipProvider>- );- }-return itemContent;})) : (diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.tsindex a11ea28aa..68ea0e9e5 100644--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts@@ -1925,6 +1925,11 @@ function findNextBlockLabel(return null;}+ // If this node itself is a conditional, prefer its own merge label+ if (currentNode.type === "conditional") {+ return currentNode.data.mergeLabel ?? null;+ }+const conditionalNodeId = currentNode.data.conditionalNodeId;if (!conditionalNodeId) {return null;