Refactor validateNode function in reactflowUtils.ts
This commit is contained in:
parent
461a0fabfa
commit
60a83d1f6a
1 changed files with 5 additions and 2 deletions
|
|
@ -313,14 +313,17 @@ export function validateNode(node: NodeType, edges: Edge[]): Array<string> {
|
||||||
) {
|
) {
|
||||||
if (hasDuplicateKeys(template[t].value))
|
if (hasDuplicateKeys(template[t].value))
|
||||||
errors.push(
|
errors.push(
|
||||||
`${type} (${getFieldTitle(
|
`${displayName || type} (${getFieldTitle(
|
||||||
template,
|
template,
|
||||||
t
|
t
|
||||||
)}) contains duplicate keys with the same values.`
|
)}) contains duplicate keys with the same values.`
|
||||||
);
|
);
|
||||||
if (hasEmptyKey(template[t].value))
|
if (hasEmptyKey(template[t].value))
|
||||||
errors.push(
|
errors.push(
|
||||||
`${type} (${getFieldTitle(template, t)}) field must not be empty.`
|
`${displayName || type} (${getFieldTitle(
|
||||||
|
template,
|
||||||
|
t
|
||||||
|
)}) field must not be empty.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return errors;
|
return errors;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue