FIX: Update categories without full page refresh (#11793)

Creating or moving a category required a full page refresh until it
showed up correctly.
This commit is contained in:
Bianca Nenciu
2021-01-22 10:21:09 +02:00
committed by GitHub
parent 9e6ff9cc67
commit d2cf43a7d5
3 changed files with 2 additions and 6 deletions

View File

@ -15,7 +15,7 @@ export default Controller.extend(ModalFunctionality, Evented, {
this.categoriesSorting = ["position"];
},
@discourseComputed("site.categories")
@discourseComputed("site.categories.[]")
categoriesBuffered(categories) {
const bufProxy = EmberObjectProxy.extend(BufferedProxy);
return categories.map((c) => bufProxy.create({ content: c }));

View File

@ -109,7 +109,7 @@ class CategoryList < DraftableList
to_delete << c
end
end
@categories.each { |c| c.subcategory_ids = subcategories[c.id] }
@categories.each { |c| c.subcategory_ids = subcategories[c.id] || [] }
@categories.delete_if { |c| to_delete.include?(c) }
end

View File

@ -26,10 +26,6 @@ class CategoryDetailedSerializer < BasicCategorySerializer
is_uncategorized
end
def include_subcategory_ids?
subcategory_ids.present?
end
def topics_day
count_with_subcategories(:topics_day)
end