File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/runtime/components/forms Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -322,6 +322,10 @@ export default defineComponent({
322322 }
323323 })
324324
325+ function isObject(object : any ): object is boolean {
326+ return ! Array .isArray (object ) && object !== null && typeof object === ' object'
327+ }
328+
325329 const label = computed (() => {
326330 if (! props .modelValue ) return null
327331
@@ -334,7 +338,7 @@ export default defineComponent({
334338 }
335339
336340 function compareValues(value1 : any , value2 : any ) {
337- if (by .value && typeof by .value !== ' function' && typeof value1 === ' object ' && typeof value2 === ' object ' ) {
341+ if (by .value && typeof by .value !== ' function' && isObject ( value1 ) && isObject ( value2 ) ) {
338342 return isEqual (value1 [props .by ], value2 [props .by ])
339343 }
340344 return isEqual (value1 , value2 )
Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ export default defineComponent({
389389
390390 const selected = computed (() => {
391391 function compareValues(value1 : any , value2 : any ) {
392- if (by .value && typeof by .value !== ' function' && typeof value1 === ' object ' && typeof value2 === ' object ' ) {
392+ if (by .value && typeof by .value !== ' function' && isObject ( value1 ) && isObject ( value2 ) ) {
393393 return isEqual (value1 [by .value ], value2 [by .value ])
394394 }
395395 return isEqual (value1 , value2 )
@@ -527,6 +527,10 @@ export default defineComponent({
527527 return get (obj , key )
528528 }
529529
530+ function isObject(object : any ): object is boolean {
531+ return ! Array .isArray (object ) && object !== null && typeof object === ' object'
532+ }
533+
530534 const filteredOptions = computed (() => {
531535 if (! query .value || debouncedSearch ) {
532536 return options .value
You can’t perform that action at this time.
0 commit comments