fix(reactivity): should not trigger when setting value to same proxy (#2904)

This commit is contained in:
liaoliao666
2021-03-30 05:52:57 +08:00
committed by GitHub
parent 4f26835dac
commit c61e767422
2 changed files with 24 additions and 2 deletions

View File

@@ -146,9 +146,10 @@ function createSetter(shallow = false) {
value: unknown,
receiver: object
): boolean {
const oldValue = (target as any)[key]
let oldValue = (target as any)[key]
if (!shallow) {
value = toRaw(value)
oldValue = toRaw(oldValue)
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
oldValue.value = value
return true