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,8 +349,8 @@ function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
return !isReadonly
} else if (key === ReactiveFlags.IS_READONLY) {
return isReadonly
} else if (
key === ReactiveFlags.RAW &&
} else if (key === ReactiveFlags.RAW) {
if (
receiver ===
(isReadonly
? shallow
@ -358,10 +358,17 @@ function createInstrumentationGetter(isReadonly: boolean, shallow: boolean) {
: readonlyMap
: shallow
? shallowReactiveMap
: reactiveMap).get(target as Target)
: 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
}
// early return undefined
return
}
return Reflect.get(
hasOwn(instrumentations, key) && key in target