fix: reload policies upon collection permission change

This commit is contained in:
Apoorv Mishra committed 2024-01-14 22:48:00 +05:30
1 parent a398cabe68
commit e6d8ca9b3d
1 file changed
+7 -2
+7 -2
View File
@@ -44,6 +44,7 @@ export default abstract class Model {
if (!relations) {
return;
}
// this is to ensure that multiple loads don’t 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;
}
}
/**