Skip to content

Commit

Permalink
Return hook result inside promise with async timer end (#4010)
Browse files Browse the repository at this point in the history
Co-authored-by: o.drapeza <o.drapeza@tinkoff.ru>
  • Loading branch information
SuperOleg39 and o.drapeza committed Mar 24, 2021
1 parent f67e6c9 commit 9d87d93
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/timers.ts
Expand Up @@ -108,7 +108,10 @@ function getPluginWithTimers(plugin: any, index: number): Plugin {
timeEnd(timerLabel, 4);
if (result && typeof result.then === 'function') {
timeStart(`${timerLabel} (async)`, 4);
result = result.then(() => timeEnd(`${timerLabel} (async)`, 4));
result = result.then((hookResult: any) => {
timeEnd(`${timerLabel} (async)`, 4);
return hookResult;
});
}
return result;
};
Expand Down

0 comments on commit 9d87d93

Please sign in to comment.