Skip to content

Commit

Permalink
widget: fix error message content
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 committed Apr 26, 2023
1 parent 7b9391c commit 0d68b6b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib/elements/ErrorMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ const FieldErrorList = ({ fieldErrors }) => {
return (
<Message.Item key={error}>
{/* when there is no field Marshmallow returns _schema */}
{error.field !== "_schema" && <strong>{error.field}: </strong>}
{error.messages.length === 1 ? (
error.messages[0]
) : (
{error.field && error.field !== "_schema" && <strong>{error.field}: </strong>}
{error.message ? (
error.message
) :
error.messages && error.messages.length === 1 ? (
error.messages[0]
) : (
<Message.List>
{error.messages.map((message) => (
<Message.Item key={message}>{message}</Message.Item>
Expand Down

0 comments on commit 0d68b6b

Please sign in to comment.