Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/runtime/components/forms/InputMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ export default defineComponent({
}
})

function isObject(object: any): object is boolean {
return !Array.isArray(object) && object !== null && typeof object === 'object'
}

const label = computed(() => {
if (!props.modelValue) return null

Expand All @@ -334,7 +338,7 @@ export default defineComponent({
}

function compareValues(value1: any, value2: any) {
if (by.value && typeof by.value !== 'function' && typeof value1 === 'object' && typeof value2 === 'object') {
if (by.value && typeof by.value !== 'function' && isObject(value1) && isObject(value2)) {
return isEqual(value1[props.by], value2[props.by])
}
return isEqual(value1, value2)
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/components/forms/SelectMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export default defineComponent({

const selected = computed(() => {
function compareValues(value1: any, value2: any) {
if (by.value && typeof by.value !== 'function' && typeof value1 === 'object' && typeof value2 === 'object') {
if (by.value && typeof by.value !== 'function' && isObject(value1) && isObject(value2)) {
return isEqual(value1[by.value], value2[by.value])
}
return isEqual(value1, value2)
Expand Down Expand Up @@ -527,6 +527,10 @@ export default defineComponent({
return get(obj, key)
}

function isObject(object: any): object is boolean {
return !Array.isArray(object) && object !== null && typeof object === 'object'
}

const filteredOptions = computed(() => {
if (!query.value || debouncedSearch) {
return options.value
Expand Down
Loading