Skip to content

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

PERF: Remove caches from Category.subcategories & Category.descendents (#31829)

David Taylor3de863c698e5
diff --git a/app/assets/javascripts/discourse/app/models/category.js b/app/assets/javascripts/discourse/app/models/category.js
index ee6b8f80879..e5d61479128 100644
--- a/app/assets/javascripts/discourse/app/models/category.js
+++ b/app/assets/javascripts/discourse/app/models/category.js
@@ -503,12 +503,10 @@ export default class Category extends RestModel {
this.set("parent_category_id", newParentCategory?.id);
}
- @computed("site.categoriesByParentId")
get subcategories() {
return this.site.categoriesByParentId.get(this.id) || [];
}
- @computed("subcategories")
get unloadedSubcategoryCount() {
return this.subcategory_count - this.subcategories.length;
}
@@ -560,8 +558,7 @@ export default class Category extends RestModel {
}
}
- @discourseComputed("subcategories")
- descendants() {
+ get descendants() {
const descendants = [this];
for (let i = 0; i < descendants.length; i++) {
if (descendants[i].subcategories) {