vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Bug Report][3.0.0-beta.2] v-combobox wrong modelValue and displayed text in v-text-field

Open antoninbeaufort opened this issue 2 years ago • 4 comments

Environment

Vuetify Version: 3.0.0-beta.2 Last working version: 2.6.4 Vue Version: 3.2.36 Browsers: Chrome 101.0.4951.67 OS: Windows

Steps to reproduce

  1. clone
  2. switch to branch v-combobox-model-value
  3. npm i
  4. npm run serve
  5. Open app in browser with console + Vue DevTools
  6. For the first and third combobox select one item, for the second and the fourth select two items
  7. Look at Vue DevTools, selected, selectedMultiple, selectedValue and selectedValues and the displayed texts on the v-text-field of v-combobox

Expected Behavior

The value for the 3rd input (using array of objects) should be .value And the display for the 4th input should be the titles

Actual Behavior

The 3rd input value is .title The 4th input display is .value

Reproduction Link

https://github.com/AntoninBeaufort/vuetify-combobox-rules/tree/v-combobox-model-value

Other comments

The problem only show up when items is an array of objects, not when it's an array of strings. Need to consider rules also when applying necessary updates #15142

antoninbeaufort avatar May 25 '22 09:05 antoninbeaufort

I can confirm that the issue still happen in @vuetify/nightly: 3.0.0-next-20220529.0 but is a little bit different:

  • In this nightly the 4th input display is correct (title)
  • The problem on the 3rd input is still the same, the modelValue of VTextField is undefined whereas the modelValue of VCombobox is the title instead of the value

antoninbeaufort avatar May 30 '22 07:05 antoninbeaufort

In 3.0.0-beta.4 the 3rd input (array of objects, single) have always the title for value, even if returnObject prop is true. In fact if returnObject is true (default) it should be { title: 'something', value: 'something' } and if false it should be the value, not title.

The 4th input is correct since https://github.com/vuetifyjs/vuetify/pull/15304

antoninbeaufort avatar Jun 17 '22 07:06 antoninbeaufort

This is expected behavior, a single v-combobox is basically a text-field, there is no difference between the model and the displayed text.

You can see the behavior you are looking for if you use v-select or v-autocomplete.

If you have any questions, please reach out to us in our Discord community.

johnleider avatar Aug 09 '22 17:08 johnleider

We discussed this and decided it is actually a bug. "The 4th input display is .value" seems to already be fixed but

  • single combobox with complex items
    • should display item.title and emit the full object
    • should not look up object items from primitives in the model

KaelWD avatar Aug 09 '22 18:08 KaelWD