Skip to content

Commit 6a7f74f

Browse files
committed
fix(core): break reference chain to instance object
Reference caused in getContextFactory, and it stored in handlerMetadataStorage in Map, that never be purged
1 parent ddc1265 commit 6a7f74f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/core/helpers/context-utils.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,11 @@ export class ContextUtils {
8989
instance?: object,
9090
callback?: Function,
9191
): (args: unknown[]) => ExecutionContextHost {
92-
const contextFactory = (args: unknown[]) => {
93-
const ctx = new ExecutionContextHost(
94-
args,
95-
instance && (instance.constructor as Type<unknown>),
96-
callback,
97-
);
92+
const type = instance && (instance.constructor as Type<unknown>);
93+
return (args: unknown[]) => {
94+
const ctx = new ExecutionContextHost(args, type, callback);
9895
ctx.setType(contextType);
9996
return ctx;
10097
};
101-
return contextFactory;
10298
}
10399
}

0 commit comments

Comments
 (0)