Skip to content

Set value to defineModel twice in child component not working as intended #10990

Closed
@dinyo

Description

@dinyo

Vue version

3.4.27

Link to minimal reproduction

https://play.vuejs.org/#eNp9Uslq40AQ/ZWmL3GIRzYzAwMe2cxCDjOQhSTHhiBLZUdJq7vpRTEI/XuqWpEskeUgJNV7r9bX8N/GJHUAvuKpy21pPHPgg9kIK1RZGW09a5iFHWvZzuqKnSD55OcI/asr8wolC/qhdB2Dnlwr55mqtpatKc9seRqxdNGVi4ViwENlZOYhRhhLY+L6S6ULkGvBKYXgmzTWiJx0MUj4nHuHpXblPnl0WuE4DSURPEd2KcFeGV9iK4KvWEQIy6TUz/9jzNsA8z6eP0D+9E780R0oJvi1BQe2BsEHzGd2D76Dz28v4YDfA4gzBInsT8AbcFoG6rGj/QmqwLZHvNjtv7j0Uu3v3PnBg3L9UNQoMdvIFxyPQIv6aPRju9+S71EnVItb7A/41g8TN8zZc+bzh4kp8Iz9tUO1Bbp3AbtSwQVdcNbgTxakX7FlixaYUG/QX0d3DHmyorjsU81O2XrT9d9pkjqTARBZomIaPDuLSfogZn+XPMQjHxdw9CSqR34kNzqTqU2nwzU2/YxtiyKCImlrp++RCIuNdDTwID3KgvdasV+5LPMntPwwP/oev9NFR0DyyPpC4dnua7BkBTwb3jP5+oO3LzmTTbg=

Steps to reproduce

click the add button.

What is expected?

number value should the same as numberRef value.

What is actually happening?

when i set defineModel value to 0, somehow is ignored because there is another setter. and it never set to 0 and the value is incrementing. but if the increment line removed, it is set to 0.

System Info

No response

Any additional comments?

is there racing condition between parent and child when sync? should i use emit instead defineModel?

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