fix(reactivity): differentiate shallow/deep proxies of same target when nested in reactive
fix #5271
This commit is contained in:
@@ -8,7 +8,8 @@ import {
|
||||
reactiveMap,
|
||||
shallowReactiveMap,
|
||||
shallowReadonlyMap,
|
||||
isReadonly
|
||||
isReadonly,
|
||||
isShallow
|
||||
} from './reactive'
|
||||
import { TrackOpTypes, TriggerOpTypes } from './operations'
|
||||
import {
|
||||
@@ -150,8 +151,10 @@ function createSetter(shallow = false) {
|
||||
): boolean {
|
||||
let oldValue = (target as any)[key]
|
||||
if (!shallow && !isReadonly(value)) {
|
||||
value = toRaw(value)
|
||||
oldValue = toRaw(oldValue)
|
||||
if (!isShallow(value)) {
|
||||
value = toRaw(value)
|
||||
oldValue = toRaw(oldValue)
|
||||
}
|
||||
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user