mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 00:06:46 +08:00
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:
@ -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 }));
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user