Skip to content

Commit

Permalink
fix: restore context.type (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
fratzinger committed Dec 8, 2022
1 parent b27f38b commit 1d934ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main/hooks/src/regular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1d934ae

Please sign in to comment.