Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 186a591

Browse files
metamattIgorMinar
authored andcommitted
fix($injector): remove INSTANTIATING entry when done
getService flags services as INSTANTIATING while it calls their provider factory, in order to detect circular dependencies. If the service is instantiated correctly, the INSTANTIATING flag is overwritten with the actual service. However, if the service is not instantiated correctly, the INSTANTIATING flag should still be removed, or all further requests for this service will be mis-detected as a circular dependency. Closes #4361 Closes #5577
1 parent a80049f commit 186a591

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/auto/injector.js

+5
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,11 @@ function createInjector(modulesToLoad) {
740740
path.unshift(serviceName);
741741
cache[serviceName] = INSTANTIATING;
742742
return cache[serviceName] = factory(serviceName);
743+
} catch (err) {
744+
if (cache[serviceName] === INSTANTIATING) {
745+
delete cache[serviceName];
746+
}
747+
throw err;
743748
} finally {
744749
path.shift();
745750
}

0 commit comments

Comments
 (0)