From 4284d6e63209acb801f110771219171cf1ebf7e4 Mon Sep 17 00:00:00 2001 From: Stefan Dirix Date: Thu, 18 Apr 2024 16:09:14 +0200 Subject: [PATCH] fix label determination --- packages/core/src/util/label.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/src/util/label.ts b/packages/core/src/util/label.ts index cd5b517dc..64cd4ef2c 100644 --- a/packages/core/src/util/label.ts +++ b/packages/core/src/util/label.ts @@ -120,13 +120,18 @@ export const computeChildLabel = ( rootSchema: JsonSchema, translateFct: Translator, uiSchema: UISchemaElement -): any => { +): string => { const childData = Resolve.data(data, childPath); if (!childLabelProp) { childLabelProp = getFirstPrimitiveProp(schema); } + // return early in case there is no prop we can query + if (!childLabelProp) { + return ''; + } + const currentValue = get(childData, childLabelProp, ''); // check whether the value is part of a oneOf or enum and needs to be translated