Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using defineModel and setting the same value, the parent set event will not be triggered. #12612

Open
masterYi2333 opened this issue Dec 25, 2024 · 2 comments
Labels
has workaround A workaround has been found to avoid the problem need discussion 🔩 p2-edge-case

Comments

@masterYi2333
Copy link

masterYi2333 commented Dec 25, 2024

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNqtU02P0zAQ/SuWL81KJVVbuFTpClj1ABKwAsQFI5Qm0653HcfyR6hU5b8ztjdJiUp3D6tKlWf8ZvzezMuRvlMqbRzQFc1MobmyxIB1iohc7teMWsPoNZO8UrW25OaOi5LsdF0RRtNZCH01o/9CFiPMYgQ6Eg27aVFXylkoSRvhEwRNmGSyqKWxJCdr0kGSI5OE7MEmV+FEsIF1WpK5j9qp/0feSZOLDpAL0DaZXwUAky0e/C+bRZkoCgMLlRK5BYwIyaK85lVVlyBQfI7as6jgBLA4j1gECCH+iZO2dIozREE7vk/vTS1x0IEgo14bR5JflOUomNEVeaSOfYWo/3wMOasdBH2h5g6KhzP5e3PwOUZvNRjQDQ67v7O5xsHF6823z3DAc3+JQpxA9IXLr2Bq4TzHCHvvZIm0T3CB7YewWi73383mYEGaTpQnOmyJUdzyzQXpA91l+rpbHk6xN9sTVu3sE1b0IxcO0Ecl7LiETz6VPBph52ThXycWTGeroSZFJzlYjxNIJVZfNlLJm+iGbOusxTfeFoIXD54kPoY0T/hks4iJlbNYOrbQ8BU9U73StTK98FsfZSOJK+mqLe5RttdxJrESKm77wg0GJvk5capELquhePLr/2P0HZIzJdNAKh0yocXLDHSbG3jWJH83oL01cY7L9E06X9L2L/jjtzM=

Steps to reproduce

click

What is expected?

The same value also triggers the set event

What is actually happening?

Set not triggered

System Info

No response

Any additional comments?

The results of the two modification methods are inconsistent. I'm not sure if this is a bug, but they were consistent in versions <=3.4.31. The scenario is that my set event performs other actions, and I don't care whether the value has changed or not.

Related discussion

@yangliguo7
Copy link
Contributor

if (
!hasChanged(emittedValue, localValue) &&
!(prevSetValue !== EMPTY_OBJ && hasChanged(value, prevSetValue))
) {

when using useModel and the data unchanged, the data will not be triggered. This is inconsistent with emit

I'm not sure if we should emit when the data hasn't changed.

If there is a definite conclusion, I can fix this problem

@edison1105 edison1105 added 🔩 p2-edge-case need discussion has workaround A workaround has been found to avoid the problem labels Dec 25, 2024
@edison1105
Copy link
Member

related #11162 #11125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround A workaround has been found to avoid the problem need discussion 🔩 p2-edge-case
Projects
None yet
Development

No branches or pull requests

3 participants