diff --git a/framework/core/js/src/common/utils/extractText.ts b/framework/core/js/src/common/utils/extractText.ts index ac5bc3a48e..e72cd13014 100644 --- a/framework/core/js/src/common/utils/extractText.ts +++ b/framework/core/js/src/common/utils/extractText.ts @@ -5,7 +5,10 @@ import type Mithril from 'mithril'; */ export default function extractText(vdom: Mithril.Children): string { if (vdom instanceof Array) { - return vdom.map((element) => extractText(element)).join(''); + return vdom + .filter((item) => item !== undefined) + .map((element) => extractText(element)) + .join(''); } else if (typeof vdom === 'object' && vdom !== null) { return extractText(vdom.children); } else {