Skip to content

Commit

Permalink
fix(runtime-dom): prevent unnecessary updates in v-model checkbox whe…
Browse files Browse the repository at this point in the history
…n value is unchanged
  • Loading branch information
jh-leong committed Oct 11, 2024
1 parent d82fa61 commit e853eb1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/runtime-dom/src/directives/vModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const vModelCheckbox: ModelDirective<HTMLInputElement> = {

function setChecked(
el: HTMLInputElement,
{ value }: DirectiveBinding,
{ value, oldValue }: DirectiveBinding,
vnode: VNode,
) {
// store the v-model value on the element so it can be accessed by the
Expand All @@ -173,6 +173,7 @@ function setChecked(
} else if (isSet(value)) {
checked = value.has(vnode.props!.value)
} else {
if (value === oldValue) return
checked = looseEqual(value, getCheckboxValue(el, true))
}

Expand Down

0 comments on commit e853eb1

Please sign in to comment.