From 3dd2cadb9bb2be6aa09d6c34ad27bd2c844f150e Mon Sep 17 00:00:00 2001 From: IanM <16573496+imorland@users.noreply.github.com> Date: Wed, 30 Nov 2022 16:39:32 +0000 Subject: [PATCH] fix: `undefined` showing in dropdown active title (#3700) --- framework/core/js/src/common/components/SelectDropdown.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/core/js/src/common/components/SelectDropdown.tsx b/framework/core/js/src/common/components/SelectDropdown.tsx index 66c66fef5..65ea46df5 100644 --- a/framework/core/js/src/common/components/SelectDropdown.tsx +++ b/framework/core/js/src/common/components/SelectDropdown.tsx @@ -21,11 +21,11 @@ function isActive(vnode: Mithril.Children): boolean { // Allow non-selectable dividers/headers to be added. if (typeof tag === 'string' && tag !== 'a' && tag !== 'button') return false; - if (typeof tag === 'object' && 'initAttrs' in tag) { + if ((typeof tag === 'object' || typeof tag === 'function') && 'initAttrs' in tag) { (tag as unknown as typeof Component).initAttrs(vnode.attrs); } - return typeof tag === 'object' && 'isActive' in tag ? (tag as any).isActive(vnode.attrs) : vnode.attrs.active; + return (typeof tag === 'object' || typeof tag === 'function') && 'isActive' in tag ? (tag as any).isActive(vnode.attrs) : vnode.attrs.active; } export interface ISelectDropdownAttrs extends IDropdownAttrs {