Skip to content

Commit 448a7f7

Browse files
atscottNothingEverHappens
authored andcommitted
refactor(core): Use promise.finally for task removal (#62674)
Updates the approach from #62631 to use Promise.finally for task removal. This is a bit cleaner and also handles rejections from the donePromise PR Close #62674
1 parent d3b770d commit 448a7f7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/core/src/platform/bootstrap.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ export function bootstrap<M>(
138138
const initStatus = envInjector.get(ApplicationInitStatus);
139139
initStatus.runInitializers();
140140

141-
return initStatus.donePromise.then(() => {
142-
try {
141+
return initStatus.donePromise
142+
.then(() => {
143143
// If the `LOCALE_ID` provider is defined at bootstrap then we set the value for ivy
144144
const localeId = envInjector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
145145
setLocaleId(localeId || DEFAULT_LOCALE_ID);
@@ -172,10 +172,8 @@ export function bootstrap<M>(
172172
moduleBootstrapImpl?.(config.moduleRef, config.allPlatformModules);
173173
return config.moduleRef;
174174
}
175-
} finally {
176-
pendingTasks.remove(taskId);
177-
}
178-
});
175+
})
176+
.finally(() => void pendingTasks.remove(taskId));
179177
});
180178
});
181179
}

0 commit comments

Comments
 (0)