diff --git a/skyvern-frontend/src/routes/workflows/Workflows.tsx b/skyvern-frontend/src/routes/workflows/Workflows.tsx index 44083c18..594afb43 100644 --- a/skyvern-frontend/src/routes/workflows/Workflows.tsx +++ b/skyvern-frontend/src/routes/workflows/Workflows.tsx @@ -293,11 +293,13 @@ function Workflows() { expandedRows, toggleExpanded: toggleParametersExpanded, setAutoExpandedRows, + setManuallyExpandedRows, } = useParameterExpansion(); useEffect(() => { if (!isSearchActive) { setAutoExpandedRows([]); + setManuallyExpandedRows(new Set()); return; } @@ -316,7 +318,13 @@ function Workflows() { setAutoExpandedRows( matchingWorkflows.map((workflow) => workflow.workflow_permanent_id), ); - }, [isSearchActive, workflows, matchesParameter, setAutoExpandedRows]); + }, [ + isSearchActive, + workflows, + matchesParameter, + setAutoExpandedRows, + setManuallyExpandedRows, + ]); function handleRowClick( event: React.MouseEvent, diff --git a/skyvern-frontend/src/routes/workflows/hooks/useParameterExpansion.ts b/skyvern-frontend/src/routes/workflows/hooks/useParameterExpansion.ts index 9dbd6df9..f15126ae 100644 --- a/skyvern-frontend/src/routes/workflows/hooks/useParameterExpansion.ts +++ b/skyvern-frontend/src/routes/workflows/hooks/useParameterExpansion.ts @@ -25,9 +25,18 @@ function useParameterExpansion() { }, []); const expandedRows = useMemo(() => { - const combined = new Set(autoExpandedRows); + const combined = new Set(); + // Symmetric difference (XOR): a row is expanded if it's in one set but not both. + // This lets manual toggles override auto-expansion (and vice versa). + for (const id of autoExpandedRows) { + if (!manuallyExpandedRows.has(id)) { + combined.add(id); + } + } for (const id of manuallyExpandedRows) { - combined.add(id); + if (!autoExpandedRows.has(id)) { + combined.add(id); + } } return combined; }, [autoExpandedRows, manuallyExpandedRows]);