Skip to content

A platform for community discussion. Free, open, simple.

FIX: Async load category for composer (#27004)

Bianca Nenciu2b5e0bca533d
diff --git a/app/assets/javascripts/discourse/app/models/composer.js b/app/assets/javascripts/discourse/app/models/composer.js
index 20e9959733a..5af6748b4b6 100644
--- a/app/assets/javascripts/discourse/app/models/composer.js
+++ b/app/assets/javascripts/discourse/app/models/composer.js
@@ -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);
+ }
}
}