fix: add receiver is not the reactive proxy judging condition

This commit is contained in:
hubvue 2024-10-22 17:43:36 +08:00
parent 4138f2153f
commit 3fc414e396
1 changed files with 18 additions and 11 deletions

View File

@ -349,18 +349,25 @@ function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
return !isReadonly
} else if (key === ReactiveFlags.IS_READONLY) {
return isReadonly
} else if (
key === ReactiveFlags.RAW &&
receiver ===
(isReadonly
? shallow
? shallowReadonlyMap
: readonlyMap
: shallow
? shallowReactiveMap
: reactiveMap).get(target as Target)
} else if (key === ReactiveFlags.RAW) {
if (
receiver ===
(isReadonly
? shallow
? shallowReadonlyMap
: readonlyMap
: shallow
? shallowReactiveMap
: reactiveMap
).get(target as Target) ||
// receiver is not the reactive proxy, but has the same prototype
// this means the reciever is a user proxy of the reactive proxy
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)
) {
return target
return target
}
// early return undefined
return
}
return Reflect.get(