vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Bug Report][3.1.4] V-Autocomplete pre selected option not working when using return-object prop

Open ThomasCarbon opened this issue 3 years ago • 6 comments

Environment

Vuetify Version: 3.1.2 Vue Version: 3.2.45 Browsers: Firefox 108.0 OS: Ubuntu 22

Steps to reproduce

Click v-autocomplete field and see there is no option pre selected while vmodel isnt empty and item value is good for the comparison. Remove firstname prop from data object and see it working.

Expected Behavior

Make pre selected option work properly when using filled vmodel and return object prop

Actual Behavior

Pre selected option doest not work when using filled vmodel and return object prop when the vmodel has additional prop

Reproduction Link

Play vuetify

Other comments

This is a side issue from https://github.com/vuetifyjs/vuetify/issues/16046 which is closed and fixed. I left a new comment but though it was better to create a new issue. This time it is maybe an expected behavior, but i think it could be a good functionality also depending on your goal.

ThomasCarbon avatar Dec 15 '22 08:12 ThomasCarbon

Also, issue when you provide items as a computed property Playground

men232 avatar Dec 20 '22 13:12 men232

Have the same issue. It looks like this image

Maybe 10 releases ago it worked but not now((

websitevirtuoso avatar Jan 09 '23 06:01 websitevirtuoso

Updated play vuetify and issue because bug still occur on 3.1.2

ThomasCarbon avatar Jan 24 '23 16:01 ThomasCarbon

Hmm I guess this would've been fixed by #16546 As of 952e36d35bc7af6ef30d0b2b8c08c1ab7838c637 it does at least work if the objects have all the same keys

KaelWD avatar Feb 08 '23 15:02 KaelWD

@KaelWD Exactly, this was my previous issue https://github.com/vuetifyjs/vuetify/issues/16046 and this is fixed But when object do have different keys, if you set "item-value" props i expect it to rely on it in priority instead of anything else. That is this case which is not working, still on 3.1.4. I will update my issue with new play vuetify

ThomasCarbon avatar Feb 09 '23 11:02 ThomasCarbon

It feels like using both return-object and item-value together is an "anti-pattern," because it is disputable which prop takes priority.

Currently, the implementation is such that return-object override item-value. (https://vuetifyjs.com/en/api/v-select/#props-return-object)

That's why issue becomes obvious when v-model equals to an object missing a key

yuwu9145 avatar May 02 '23 23:05 yuwu9145