mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(core): throw an Cyclic Dependency Error in prod mode (#60118)
Prior to this change, cyclic injection didn't trigger any error in prod mode, resulting into injecting the `CIRCULAR` object. This could lead to strange errors where no method would be found on the token. fixes #60074 PR Close #60118
This commit is contained in:
committed by
Miles Malerba
parent
b4feeb5a7d
commit
4aeec9fa7d
@@ -473,7 +473,7 @@ export class R3Injector extends EnvironmentInjector {
|
||||
private hydrate<T>(token: ProviderToken<T>, record: Record<T>): T {
|
||||
const prevConsumer = setActiveConsumer(null);
|
||||
try {
|
||||
if (ngDevMode && record.value === CIRCULAR) {
|
||||
if (record.value === CIRCULAR) {
|
||||
throwCyclicDependencyError(stringify(token));
|
||||
} else if (record.value === NOT_YET) {
|
||||
record.value = CIRCULAR;
|
||||
|
||||
@@ -478,6 +478,7 @@
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"style",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"transition",
|
||||
|
||||
@@ -504,6 +504,7 @@
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"style",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"transition",
|
||||
|
||||
@@ -410,6 +410,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"uniqueIdCounter",
|
||||
|
||||
@@ -881,6 +881,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"trackMovedView",
|
||||
|
||||
@@ -613,6 +613,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwInvalidWriteToSignalError",
|
||||
"throwInvalidWriteToSignalErrorFn",
|
||||
"throwProviderNotFoundError",
|
||||
|
||||
@@ -606,6 +606,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwInvalidWriteToSignalError",
|
||||
"throwInvalidWriteToSignalErrorFn",
|
||||
"throwProviderNotFoundError",
|
||||
|
||||
@@ -332,6 +332,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"uniqueIdCounter",
|
||||
|
||||
@@ -442,6 +442,7 @@
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"subscribeOn",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"transferCacheInterceptorFn",
|
||||
|
||||
@@ -703,6 +703,7 @@
|
||||
"take",
|
||||
"takeLast",
|
||||
"tap",
|
||||
"throwCyclicDependencyError",
|
||||
"throwError2",
|
||||
"throwIfEmpty",
|
||||
"throwInvalidWriteToSignalErrorFn",
|
||||
|
||||
@@ -367,6 +367,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"uniqueIdCounter",
|
||||
|
||||
@@ -490,6 +490,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"toTStylingRange",
|
||||
|
||||
Reference in New Issue
Block a user