fix(runtime-dom): prevent unnecessary updates in v-model checkbox when value is unchanged#12146
Merged
yyx990803 merged 3 commits intovuejs:mainfrom Oct 11, 2024
Merged
fix(runtime-dom): prevent unnecessary updates in v-model checkbox when value is unchanged#12146yyx990803 merged 3 commits intovuejs:mainfrom
yyx990803 merged 3 commits intovuejs:mainfrom
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-sfc
@vue/compiler-dom
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
@vue/compat
vue
commit: |
Member
Author
|
/ecosystem-ci run |
Contributor
|
📝 Ran ecosystem CI: Open
|
Contributor
|
Potentially a fix for #8638. |
Contributor
|
I think this fix may suffer from a similar problem to #8639: |
edison1105
requested changes
Oct 11, 2024
cd9d697 to
ab185e8
Compare
…n value is unchanged
edison1105
approved these changes
Oct 11, 2024
abdullah-wn
pushed a commit
to Lazy-work/vue
that referenced
this pull request
Jan 4, 2025
…n value is unchanged (vuejs#12146) close vuejs#12144
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #12144
In the browser, the event order for an input click is
click->change.When the
clickevent has side effects,vModelCheckbox'sbeforeUpdatehook updatesel.checkedbased on the oldbinding, causing it to reset incorrectly. Thechangeevent then updates thebindingwith the wrong value, leading to the issue.This PR ensures
el.checkedis only updated when thebindingchanges, fixing a 3.5 regression and restoring 3.4 behavior.NOTE: This PR only addresses cases where the value is neither an array nor a set (issue #8638 is still unhandled).