Skip to content

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

FIX: category-selector for top level categories (#24627)

Bianca Nenciu1881ae50be4a
diff --git a/app/assets/javascripts/select-kit/addon/components/category-drop.js b/app/assets/javascripts/select-kit/addon/components/category-drop.js
index 2cf701b87bc..fa456a38b14 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-drop.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-drop.js
@@ -134,14 +134,10 @@ export default ComboBoxComponent.extend({
),
async search(filter) {
- const opts = {
- parentCategoryId: this.options.parentCategory?.id || -1,
- includeUncategorized: this.siteSettings.allow_uncategorized_topics,
- };
-
if (this.siteSettings.lazy_load_categories) {
const results = await Category.asyncSearch(filter, {
- ...opts,
+ parentCategoryId: this.options.parentCategory?.id || -1,
+ includeUncategorized: this.siteSettings.allow_uncategorized_topics,
limit: 15,
});
return this.shortcuts.concat(
@@ -157,6 +153,10 @@ export default ComboBoxComponent.extend({
);
}
+ const opts = {
+ parentCategoryId: this.options.parentCategory?.id,
+ };
+
if (filter) {
let results = Category.search(filter, opts);
return this._filterUncategorized(results).sort((a, b) => {