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

View File

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