Skip to content
Permalink
Browse files

perf(core): Avoid unnecessary creating provider factory (#33742)

In providerToRecord move creating the factory into a condition which
actually needs it to avoid unnecessary creating it

PR Close #33742
  • Loading branch information
NothingEverHappens authored and kara committed Nov 11, 2019
1 parent bb9b803 commit c315881d04ad9daf9cf9400b439fe6a0350056f8
Showing with 1 addition and 1 deletion.
  1. +1 −1 packages/core/src/di/r3_injector.ts
@@ -461,10 +461,10 @@ function getUndecoratedInjectableFactory(token: Function) {

function providerToRecord(
provider: SingleProvider, ngModuleType: InjectorType<any>, providers: any[]): Record<any> {
let factory: (() => any)|undefined = providerToFactory(provider, ngModuleType, providers);
if (isValueProvider(provider)) {
return makeRecord(undefined, provider.useValue);
} else {
const factory: (() => any)|undefined = providerToFactory(provider, ngModuleType, providers);
return makeRecord(factory, NOT_YET);
}
}

0 comments on commit c315881

Please sign in to comment.
You can’t perform that action at this time.