From 3796fbf4b86db696fc84ddc3b096d024a72f276c Mon Sep 17 00:00:00 2001 From: Sam Al Arbid Date: Wed, 26 Apr 2023 14:14:41 +0200 Subject: [PATCH] widget: fix error message content --- src/lib/elements/ErrorMessage.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/elements/ErrorMessage.js b/src/lib/elements/ErrorMessage.js index d11ababb..50494a6f 100644 --- a/src/lib/elements/ErrorMessage.js +++ b/src/lib/elements/ErrorMessage.js @@ -16,8 +16,12 @@ const FieldErrorList = ({ fieldErrors }) => { return ( {/* when there is no field Marshmallow returns _schema */} - {error.field !== "_schema" && {error.field}: } - {error.messages.length === 1 ? ( + {error.field && error.field !== "_schema" && ( + {error.field}: + )} + {error.message ? ( + error.message + ) : error.messages && error.messages.length === 1 ? ( error.messages[0] ) : (