refactor(field): no duplicate errors (#8514)

* chore: tweaks > field.tsx

apps/v4/registry/new-york-v4/ui/field.tsx

* chore: tweaks > field.tsx

apps/v4/registry/new-york-v4/ui/field.tsx

* chore: tweaks > field.json field.json

apps/www/public/r/styles/new-york-v4/field.json
apps/v4/public/r/styles/new-york-v4/field.json
This commit is contained in:
Neeraj Dalal
2025-10-21 17:32:52 +05:30
committed by GitHub
parent 6f093a0f3f
commit 188b746074
3 changed files with 9 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -200,13 +200,17 @@ function FieldError({
return null
}
if (errors?.length == 1) {
return errors[0]?.message
const uniqueErrors = [
...new Map(errors.map((error) => [error?.message, error])).values(),
]
if (uniqueErrors?.length == 1) {
return uniqueErrors[0]?.message
}
return (
<ul className="ml-4 flex list-disc flex-col gap-1">
{errors.map(
{uniqueErrors.map(
(error, index) =>
error?.message && <li key={index}>{error.message}</li>
)}

File diff suppressed because one or more lines are too long