fix(cordis): preserve concurrent loader composition

This commit is contained in:
Tianyi Cui
2026-07-30 06:23:16 +08:00
parent 2fe205f01a
commit 0a297c39d3
6 changed files with 18 additions and 11 deletions

View File

@@ -68,7 +68,12 @@ export class EntryGroup {
const newMap = Object.fromEntries(config.map(options => [options.id, options]))
try {
for (const options of config) await this.create(options)
const outcomes = await Promise.allSettled(config.map(options => this.create(options)))
const failures = outcomes
.filter((outcome): outcome is PromiseRejectedResult => outcome.status === 'rejected')
.map(outcome => outcome.reason)
if (failures.length === 1) throw failures[0]
if (failures.length > 1) throw new AggregateError(failures, 'loader entries failed to apply')
for (const id of Object.keys(oldMap)) {
if (!newMap[id]) await this.remove(id, true)
}