Skip to content

Commit

Permalink
Fix end of zone
Browse files Browse the repository at this point in the history
  • Loading branch information
betula committed Jan 20, 2020
1 parent 81e339e commit 128bb80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function zone<T = void>(callback: () => T): Promise<void> {
reject(error);
}
delete zoneParentIndex[asyncId];
cleanupZone(asyncId);
resetZone(asyncId);
});
});
}
Expand Down Expand Up @@ -129,7 +129,7 @@ export function reset() {
});
}

export function cleanupZone(zoneId: number) {
function resetZone(zoneId: number) {
if (instances[zoneId]) {
instances[zoneId].clear();
delete instances[zoneId];
Expand All @@ -138,6 +138,10 @@ export function cleanupZone(zoneId: number) {
resolvePhases[zoneId].clear();
delete resolvePhases[zoneId];
}
if (overrides[zoneId]) {
overrides[zoneId].clear();
delete overrides[zoneId];
}
}

function createProvideDescriptor(dep: Dep, propertyKey: PropertyKey) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-provide",
"version": "0.4.2",
"version": "0.4.3",
"description": "Async context based Dependency Injection for Node.JS",
"repository": {
"url": "https://github.com/betula/node-provide"
Expand Down

0 comments on commit 128bb80

Please sign in to comment.