From e63c377283555c4177c174ccd1a5a2e6f3ec6f42 Mon Sep 17 00:00:00 2001 From: Mike Fortman Date: Tue, 1 Oct 2024 10:22:31 -0500 Subject: [PATCH] fix: Only show error state on components w/ errors for node validation (#3968) * Only show error state on components w/ errors for node validation * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/frontend/src/utils/reactflowUtils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 737e948db..433ced9c0 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -471,7 +471,11 @@ Array<{ id: string; errors: Array }> { ]; } // validateNode(n, edges) returns an array of errors for the node - return nodes.map((n) => ({ id: n.id, errors: validateNode(n, edges) })); + const nodeMap = nodes.map((n) => ({ + id: n.id, + errors: validateNode(n, edges), + })); + return nodeMap.filter((n) => n.errors?.length); } export function updateEdges(edges: Edge[]) {