Skip to content

v-model on <select multiple> uses stale collection type after switching between Array and Set #15009

Description

@zongxi1115

Vue version

3.5.39

Link to minimal reproduction

https://play.vuejs.org/#__PROD__eNp9Uk1P4zAQ/SuWLwWJTQ/dPSwK1X6Iw+4BEHDDCAV3UgyObdnjtFKU/86MQwtIwMWK57158+bFg/wdQtVnkMeyTjqagCIB5rBUznTBRxSDiNCKUbTRd2JG1JlyymnvElMtaISVOGHSwc3tIWNtdhqNdyJtDOqHa38FeHAoBuXEvqPqG5uB+hxsBOM3s9b7GQuMytXzyQu5oAtCF2yDQDch6vuMSNq/tDX66UTJN0OUXE43gZ5F6/lELjLUOg0X/bfOr8By74sbJUWXLZpgpyHE9aGsUGwSk8yROp31fEI+4d03kXh0vuPRPmXSzkiIsByG3fRxrOdc4b33u8ojiYlSbs26ekze0Q8qASqpfReMhXhe9JOSx1O0jDXW+s3/UsOY4WhX1w+gnz6oP6Yt15S8iJAg9qDkHsMmrjlThk+vzmBL33uQEsyW2F+Al5C8zexxov3JbkW23/CK23/lmRm3vk6nWwSXdkuxUWaOha8kPb2/X6z+andRfS999JQoxbseImtSgIvqR7X4Kcdnt8MAPA==

Steps to reproduce

  1. Bind a <select multiple v-model> to an Array.
  2. Switch the bound value to a Set at runtime.
  3. Interact with the select again.
  4. The emitted model becomes an Array again.
  5. Switching back from Set -> Array shows the same stale-type behavior in reverse.

What is expected?

The current collection type should be respected after the model switches at runtime.

What is actually happening?

The change handler keeps using the collection type captured when the directive was created, so the first user interaction after a runtime Array/Set switch emits the old type.

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions