-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
fix(runtime-dom): prevent unnecessary DOM update from v-model #11656
fix(runtime-dom): prevent unnecessary DOM update from v-model #11656
Conversation
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-dom
@vue/runtime-core
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
there are failures on ecosystem CI, can someone advise me how to fix it? |
} | ||
assign(cloned) | ||
assign(new Set(updatedValue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change here is not necessary.
We've already cloned the set on line 141
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edison1105
Thank you for review!
Obviously, it was unnecessary, I've fixed it!
@Procrustes5 |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
I would like to confirm something: If we repeatedly assign the same value to |
@Mini-ghost if (el.checked !== checked) {
el.checked = checked
} |
Description
This PR addresses an issue where the v-model directive for checkboxes was causing unnecessary DOM updates. The fix optimizes the setChecked function to only update the DOM when the checkbox state has actually changed.
Related Issue
close #11647
Proposed Changes
Updated the setChecked function in the vModelCheckbox directive to compare the new calculated state with the current state before updating.
Modified the beforeUpdate hook to only call setChecked if the value has actually changed.
Added new test cases to verify the optimization and ensure no regression in functionality.