Fix parameter toggle not collapsing auto-expanded rows (#SKY-7982) (#4741)

Co-authored-by: Suchintan Singh <suchintan@skyvern.com>
This commit is contained in:
Suchintan
2026-02-13 00:34:18 -05:00
committed by GitHub
parent c1272b3701
commit 0243ae1375
2 changed files with 20 additions and 3 deletions

View File

@@ -293,11 +293,13 @@ function Workflows() {
expandedRows, expandedRows,
toggleExpanded: toggleParametersExpanded, toggleExpanded: toggleParametersExpanded,
setAutoExpandedRows, setAutoExpandedRows,
setManuallyExpandedRows,
} = useParameterExpansion(); } = useParameterExpansion();
useEffect(() => { useEffect(() => {
if (!isSearchActive) { if (!isSearchActive) {
setAutoExpandedRows([]); setAutoExpandedRows([]);
setManuallyExpandedRows(new Set());
return; return;
} }
@@ -316,7 +318,13 @@ function Workflows() {
setAutoExpandedRows( setAutoExpandedRows(
matchingWorkflows.map((workflow) => workflow.workflow_permanent_id), matchingWorkflows.map((workflow) => workflow.workflow_permanent_id),
); );
}, [isSearchActive, workflows, matchesParameter, setAutoExpandedRows]); }, [
isSearchActive,
workflows,
matchesParameter,
setAutoExpandedRows,
setManuallyExpandedRows,
]);
function handleRowClick( function handleRowClick(
event: React.MouseEvent<HTMLTableCellElement>, event: React.MouseEvent<HTMLTableCellElement>,

View File

@@ -25,10 +25,19 @@ function useParameterExpansion() {
}, []); }, []);
const expandedRows = useMemo(() => { const expandedRows = useMemo(() => {
const combined = new Set(autoExpandedRows); const combined = new Set<string>();
for (const id of manuallyExpandedRows) { // 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); combined.add(id);
} }
}
for (const id of manuallyExpandedRows) {
if (!autoExpandedRows.has(id)) {
combined.add(id);
}
}
return combined; return combined;
}, [autoExpandedRows, manuallyExpandedRows]); }, [autoExpandedRows, manuallyExpandedRows]);