diff --git a/src/utils/lazy.ts b/src/utils/lazy.ts index 76bcbb159..439ec1bef 100644 --- a/src/utils/lazy.ts +++ b/src/utils/lazy.ts @@ -43,7 +43,10 @@ const handler: ProxyHandler = { ...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName => [propName, (target: any, ...args: any[]) => Reflect[propName](target[proxyLazyGet](), ...args)] )), - set: (target, p, newValue) => Reflect.set(target[proxyLazyGet](), p, newValue, target[proxyLazyGet]()), + set: (target, p, newValue) => { + const lazyTarget = target[proxyLazyGet](); + return Reflect.set(lazyTarget, p, newValue, lazyTarget); + }, ownKeys: target => { const keys = Reflect.ownKeys(target[proxyLazyGet]()); for (const key of unconfigurable) { diff --git a/src/utils/proxyInner.ts b/src/utils/proxyInner.ts index 2511649a5..51d62bdc4 100644 --- a/src/utils/proxyInner.ts +++ b/src/utils/proxyInner.ts @@ -22,7 +22,10 @@ const handler: ProxyHandler = { ...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName => [propName, (target: any, ...args: any[]) => Reflect[propName](target[proxyInnerGet](), ...args)] )), - set: (target, p, value) => Reflect.set(target[proxyInnerGet](), p, value, target[proxyInnerGet]()), + set: (target, p, value) => { + const innerTarget = target[proxyInnerGet](); + return Reflect.set(innerTarget, p, value, innerTarget); + }, ownKeys: target => { const keys = Reflect.ownKeys(target[proxyInnerGet]()); for (const key of unconfigurable) {