Misc fixes ported from #5814

This commit is contained in:
Tom Moor
2024-01-24 22:43:10 -05:00
parent df816c200f
commit cab9a1ec96
5 changed files with 24 additions and 8 deletions

View File

@@ -44,6 +44,7 @@ export default abstract class Model {
if (!relations) {
return;
}
// this is to ensure that multiple loads dont happen in parallel
if (this.loadingRelations) {
return this.loadingRelations;
}
@@ -64,8 +65,12 @@ export default abstract class Model {
promises.push(this.store.fetch(this.id, { force: true }));
}
this.loadingRelations = Promise.all(promises);
return await this.loadingRelations;
try {
this.loadingRelations = Promise.all(promises);
return await this.loadingRelations;
} finally {
this.loadingRelations = undefined;
}
}
/**