Skip to content

Commit

Permalink
fix: middleware sort issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnayax committed Jan 27, 2025
1 parent 08fce4a commit 58fcd88
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/middleware/middleware-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,17 @@ export class MiddlewareModule<
([moduleA], [moduleB]) => {
const moduleARef = this.container.getModuleByKey(moduleA)!;
const moduleBRef = this.container.getModuleByKey(moduleB)!;
if (moduleARef.distance === Number.MAX_VALUE) {
const isModuleAGlobal = moduleARef.distance === Number.MAX_VALUE;
const isModuleBGlobal = moduleBRef.distance === Number.MAX_VALUE;
if (isModuleAGlobal && isModuleBGlobal) {
return 0;
}
if (isModuleAGlobal) {
return -1;
}
if (moduleBRef.distance === Number.MAX_VALUE) {
if (isModuleBGlobal) {
return 1;
}

return moduleARef.distance - moduleBRef.distance;
},
);
Expand Down

0 comments on commit 58fcd88

Please sign in to comment.