Skip to content

Commit f9e3ca1

Browse files
committed
fix(runtime-dom): prevent unnecessary updates in v-model checkbox when value is unchanged
1 parent 35785f3 commit f9e3ca1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: packages/runtime-dom/src/directives/vModel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export const vModelCheckbox: ModelDirective<HTMLInputElement> = {
160160

161161
function setChecked(
162162
el: HTMLInputElement,
163-
{ value }: DirectiveBinding,
163+
{ value, oldValue }: DirectiveBinding,
164164
vnode: VNode,
165165
) {
166166
// store the v-model value on the element so it can be accessed by the
@@ -177,7 +177,7 @@ function setChecked(
177177
}
178178

179179
// Only update if the checked state has changed
180-
if (el.checked !== checked) {
180+
if (el.checked !== checked && value !== oldValue) {
181181
el.checked = checked
182182
}
183183
}

0 commit comments

Comments
 (0)