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
f24a8c60ad
commit
2bffacbe5e
@@ -469,7 +469,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;
|
||||
|
||||
@@ -477,6 +477,7 @@
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"style",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"transition",
|
||||
|
||||
@@ -503,6 +503,7 @@
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"style",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"transition",
|
||||
|
||||
@@ -409,6 +409,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"uniqueIdCounter",
|
||||
|
||||
@@ -879,6 +879,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",
|
||||
|
||||
@@ -329,6 +329,7 @@
|
||||
"storeLViewOnDestroy",
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"uniqueIdCounter",
|
||||
|
||||
@@ -441,6 +441,7 @@
|
||||
"stringify",
|
||||
"stringifyCSSSelector",
|
||||
"subscribeOn",
|
||||
"throwCyclicDependencyError",
|
||||
"throwProviderNotFoundError",
|
||||
"timeoutProvider",
|
||||
"transferCacheInterceptorFn",
|
||||
|
||||
@@ -703,6 +703,7 @@
|
||||
"take",
|
||||
"takeLast",
|
||||
"tap",
|
||||
"throwCyclicDependencyError",
|
||||
"throwError2",
|
||||
"throwIfEmpty",
|
||||
"throwInvalidWriteToSignalErrorFn",
|
||||
|
||||
@@ -366,6 +366,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