From 60a83d1f6aceb51cc9fa5e693348294f1362e844 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 21 Mar 2024 16:39:37 -0300 Subject: [PATCH] Refactor validateNode function in reactflowUtils.ts --- src/frontend/src/utils/reactflowUtils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index edd48354e..ba2ddb81b 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -313,14 +313,17 @@ export function validateNode(node: NodeType, edges: Edge[]): Array { ) { if (hasDuplicateKeys(template[t].value)) errors.push( - `${type} (${getFieldTitle( + `${displayName || type} (${getFieldTitle( template, t )}) contains duplicate keys with the same values.` ); if (hasEmptyKey(template[t].value)) errors.push( - `${type} (${getFieldTitle(template, t)}) field must not be empty.` + `${displayName || type} (${getFieldTitle( + template, + t + )}) field must not be empty.` ); } return errors;