From 6a7f74f0c770a80ab9d03da801e7b1c502adb1ab Mon Sep 17 00:00:00 2001 From: breeeew Date: Wed, 27 Mar 2024 07:51:21 +0300 Subject: [PATCH] fix(core): break reference chain to instance object Reference caused in getContextFactory, and it stored in handlerMetadataStorage in Map, that never be purged --- packages/core/helpers/context-utils.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/core/helpers/context-utils.ts b/packages/core/helpers/context-utils.ts index 10c67b5a879..7ff661a5688 100644 --- a/packages/core/helpers/context-utils.ts +++ b/packages/core/helpers/context-utils.ts @@ -89,15 +89,11 @@ export class ContextUtils { instance?: object, callback?: Function, ): (args: unknown[]) => ExecutionContextHost { - const contextFactory = (args: unknown[]) => { - const ctx = new ExecutionContextHost( - args, - instance && (instance.constructor as Type), - callback, - ); + const type = instance && (instance.constructor as Type); + return (args: unknown[]) => { + const ctx = new ExecutionContextHost(args, type, callback); ctx.setType(contextType); return ctx; }; - return contextFactory; } }