Skip to content

Regression of multiselect integer form values (>=3.4.15) #10574

Closed
@axllent

Description

@axllent

Vue version

>= 3.4.15

Link to minimal reproduction

https://codepen.io/axllent/pen/KKYmZEq

Steps to reproduce

Please see the reproduction link. Since 3.4.15 all HTML multiselect options are only preselected if the data array values are strings. Integer array values are now ignored and not matched to their string "counterparts".

What is expected?

In the following example the multiselect form field have pre-selected values (Vue <= 3.4.14): https://codepen.io/axllent/pen/YzMVxvb

What is actually happening?

It seems Vue disregards the original model values due to the int -> string type change. This is a change in behaviour to all previous versions of Vue, and differs in behaviour to single select fields which continue to work as expected (eg: integer value 2 is matched correctly to <option value="2">Two</option>).

System Info

N/A - impacts Firefox & Chrome on Linux, Mac and Windows.

Any additional comments?

Vue has always had a relaxed integer -> string relationship regarding selected values in forms, given that all form select values are in fact strings (eg: <option value="2">Two</option>).

I have worked out that this regression was introduced in 3.4.15, and I suspect via commit v-model: optimize v-model multiple select w/ large lists (2ffb956).

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.🐞 bugSomething isn't workinghas workaroundA workaround has been found to avoid the problemregressionscope: v-model

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions