Skip to content

defineModel push array doesnt trigger the value #11143

@modos

Description

@modos

Vue version

3.4.29

Link to minimal reproduction

https://play.vuejs.org/#eNp9UUtPAjEQ/itNT5iQJT4u4kJUwkETH1Fv1pi1O0Ch2zbtFDfZ7H93uhuQA+HW7zFfvpk2/M65bBuBj3kepFcOWQCMbiqMtCYgkzYaZBNWwkIZeLIl6EFDoIgax+zzqz27ESYf9bM0RQChcrpAIMRY0/QRbZtQ/hMRrWG3Uiu5mQjeaZmLYTU4pyQ+nSUiH/U+SshHB3F8yDFQr4VaZutgDbVuUmzKqZzS4F8cKuot+Jh1StIKre3vY8ehjzDc8XIFcnOEX4c6cYK/egjgtyD4XsPCLwF7ef7+DDW992Jly6jJfUJ8g2B1TB172300JdU+8HVtHypnPSqz/AjzGsGE3VKpaHK2nV9w+rrZidX/615mV92cMC1d8XsLPmXSAUnILq55+wfSta33

Steps to reproduce

declared an array with defineModel macro, if you want to add a value to array with push() method, it doesn't trigger the value of the array

What is expected?

click on the button should add a value to array and trigger the reactivity.

What is actually happening?

new value doesn't add to array when clicked on the button

System Info

No response

Any additional comments?

temporary we can use something like array = [...array] after push new value to trigger the reactivity but i dont think it's such a good idea. this issue reminds me of the $vue.set method that we have to use when pushing items to array in vue 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions