From 35a4a362eeca58636f115777311fa19bb1b7e679 Mon Sep 17 00:00:00 2001 From: hoangquocvietuet Date: Tue, 18 Feb 2025 21:14:56 +0700 Subject: [PATCH] try to revert proxy handler --- packages/object/src/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/object/src/index.ts b/packages/object/src/index.ts index 877a0f55..e0a7b366 100644 --- a/packages/object/src/index.ts +++ b/packages/object/src/index.ts @@ -134,17 +134,17 @@ export class DRPObject implements ObjectPb.DRPObjectBase { const fullPropKey = String(propKey); return new Proxy(target[propKey as keyof object], { apply(applyTarget, thisArg, args) { + if ((propKey as string).startsWith("query_")) { + return Reflect.apply(applyTarget, thisArg, args); + } const callerName = new Error().stack?.split("\n")[2]?.trim().split(" ")[1]; - const startWithQuery = (propKey as string).startsWith("query_"); - const startWithResolveConflicts = callerName?.startsWith( - "DRPObject.resolveConflicts" - ); - const startWithProxy = callerName?.startsWith("Proxy."); - const needReflect = startWithQuery || startWithResolveConflicts || startWithProxy; - if (needReflect) { + if (callerName?.startsWith("DRPObject.resolveConflicts")) { return Reflect.apply(applyTarget, thisArg, args); } - return obj.callFn(fullPropKey, args, vertexType); + if (!callerName?.startsWith("Proxy.")) { + return obj.callFn(fullPropKey, args, vertexType); + } + return Reflect.apply(applyTarget, thisArg, args); }, }); }