Skip to content

Commit

Permalink
try to revert proxy handler
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangquocvietuet committed Feb 18, 2025
1 parent 8ffdcec commit 35a4a36
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/object/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});
}
Expand Down

0 comments on commit 35a4a36

Please sign in to comment.