fix(runtime-core): allow spying on proxy methods regression (#5417)

fix #5415 (regression by #4216)
This commit is contained in:
lidlanca
2022-02-13 20:40:12 -05:00
committed by GitHub
parent cea82cffa3
commit 1574edd490
2 changed files with 151 additions and 5 deletions

View File

@@ -455,8 +455,9 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
descriptor: PropertyDescriptor
) {
if (descriptor.get != null) {
this.set!(target, key, descriptor.get(), null)
} else if (descriptor.value != null) {
// invalidate key cache of a getter based property #5417
target.$.accessCache[key] = 0;
} else if (hasOwn(descriptor,'value')) {
this.set!(target, key, descriptor.value, null)
}
return Reflect.defineProperty(target, key, descriptor)