diff --git a/main/hooks/src/regular.ts b/main/hooks/src/regular.ts index e29cf57..64b2f9c 100644 --- a/main/hooks/src/regular.ts +++ b/main/hooks/src/regular.ts @@ -11,10 +11,11 @@ export interface RegularHookMap { } export const runHook = (hook: RegularMiddleware, context: any, type?: string) => { + const typeBefore = context.type; if (type) context.type = type; return Promise.resolve(hook.call(context.self, context)) .then((res: any) => { - if (type) context.type = null; + if (type) context.type = typeBefore; if (res && res !== context) { Object.assign(context, res); }