From 488707e1483caee1dc3b4d8d7261df4282cac6b9 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Mon, 14 Jul 2025 10:40:24 +0200 Subject: [PATCH] fix(InputMenu/SelectMenu): filter null items in search --- src/runtime/components/InputMenu.vue | 8 ++++++-- src/runtime/components/SelectMenu.vue | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/runtime/components/InputMenu.vue b/src/runtime/components/InputMenu.vue index 528cfecb..bd4eb559 100644 --- a/src/runtime/components/InputMenu.vue +++ b/src/runtime/components/InputMenu.vue @@ -258,8 +258,12 @@ const filteredGroups = computed(() => { const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey] as string[] - return groups.value.map(group => group.filter((item) => { - if (typeof item !== 'object' || item === null) { + return groups.value.map(items => items.filter((item) => { + if (item === undefined || item === null) { + return false + } + + if (typeof item !== 'object') { return contains(String(item), searchTerm.value) } diff --git a/src/runtime/components/SelectMenu.vue b/src/runtime/components/SelectMenu.vue index cb45c641..61614f99 100644 --- a/src/runtime/components/SelectMenu.vue +++ b/src/runtime/components/SelectMenu.vue @@ -260,7 +260,11 @@ const filteredGroups = computed(() => { const fields = Array.isArray(props.filterFields) ? props.filterFields : [props.labelKey] as string[] return groups.value.map(items => items.filter((item) => { - if (typeof item !== 'object' || item === null) { + if (item === undefined || item === null) { + return false + } + + if (typeof item !== 'object') { return contains(String(item), searchTerm.value) }