FIX: Async load category for composer (#27004)

Categories are loaded in the composer via the category chooser, but
that only loads a subset of the fields. With these changes, the category
will be loaded async to make sure that the template is updated.
This commit is contained in:
Bianca Nenciu 2024-05-15 18:55:15 +03:00 committed by GitHub
parent c3923574b9
commit 2b5e0bca53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -248,7 +248,13 @@ export default class Composer extends RestModel {
this._categoryId = categoryId;
if (oldCategoryId !== categoryId) {
this.applyTopicTemplate(oldCategoryId, categoryId);
if (this.site.lazy_load_categories) {
Category.asyncFindById(categoryId).then(() => {
this.applyTopicTemplate(oldCategoryId, categoryId);
});
} else {
this.applyTopicTemplate(oldCategoryId, categoryId);
}
}
}