mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
fix(core): fix lifecycle hooks for middleware, injectables
This commit is contained in:
@@ -43,7 +43,12 @@ export async function callModuleDestroyHook(module: Module): Promise<any> {
|
||||
// Module (class) instance is the first element of the providers array
|
||||
// Lifecycle hook has to be called once all classes are properly destroyed
|
||||
const [_, { instance: moduleClassInstance }] = providers.shift();
|
||||
const instances = [...module.controllers, ...providers];
|
||||
const instances = [
|
||||
...module.controllers,
|
||||
...providers,
|
||||
...module.injectables,
|
||||
...module.middlewares,
|
||||
];
|
||||
|
||||
const nonTransientInstances = getNonTransientInstances(instances);
|
||||
await Promise.all(callOperator(nonTransientInstances));
|
||||
|
||||
Reference in New Issue
Block a user