Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: don't invoke Vue getters in setter (#786)
Fixes #498
  • Loading branch information
chearon committed Aug 14, 2021
1 parent 1b63186 commit e67940f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/reactivity/reactive.ts
Expand Up @@ -94,14 +94,14 @@ export function defineAccessControl(target: AnyObject, key: any, val?: any) {
set: function setterHandler(newVal: any) {
if (getter && !setter) return

const value = getter ? getter.call(target) : val
// If the key is equal to RefKey, skip the unwrap logic
// If and only if "value" is ref and "newVal" is not a ref,
// the assignment should be proxied to "value" ref.
if (key !== RefKey && isRef(value) && !isRef(newVal)) {
value.value = newVal
if (key !== RefKey && isRef(val) && !isRef(newVal)) {
val.value = newVal
} else if (setter) {
setter.call(target, newVal)
val = newVal
} else {
val = newVal
}
Expand Down

0 comments on commit e67940f

Please sign in to comment.