Skip to content

Commit

Permalink
fix(di): removed additional loop for iterating over providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Stradivario committed Mar 7, 2024
1 parent 72aee4e commit add716a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": false
"editor.formatOnSave": true
},
"eslint.autoFixOnSave": true,
"eslint.validate": [
Expand All @@ -26,4 +26,4 @@
"https://cdn.esm.sh": false,
"https://deno.land": true
} // also provides unstable type declarations in VS Code
}
}
7 changes: 4 additions & 3 deletions packages/di/src/module/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ export const Module = <T>(
}

const providers = (entries.providers || []) as WithProviders[];
const factories = filterNonNull(providers).filter(v => !!v.useFactory);

for (const entry of factories) {
ProvidersMetadata.set(entry, entry);
for (const entry of providers) {
if (entry.useFactory) {
ProvidersMetadata.set(entry, entry);
}
}

for (const entry of filterNonNull(
Expand Down

0 comments on commit add716a

Please sign in to comment.