fix: visibleOptions respecting optionGroupChildren (#3804)

pull/3815/head
Inesh Bose 2023-03-27 11:32:57 +01:00 committed by GitHub
parent ac0aad62c6
commit ad6b71074a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -978,9 +978,10 @@ export default {
const filtered = []; const filtered = [];
optionGroups.forEach((group) => { optionGroups.forEach((group) => {
const filteredItems = group.items.filter((item) => filteredOptions.includes(item)); const groupChildren = this.getOptionGroupChildren(group);
const filteredItems = groupChildren.filter((item) => filteredOptions.includes(item));
if (filteredItems.length > 0) filtered.push({ ...group, items: [...filteredItems] }); if (filteredItems.length > 0) filtered.push({ ...group, [typeof this.optionGroupChildren === 'string' ? this.optionGroupChildren : 'items']: [...filteredItems] });
}); });
return this.flatOptions(filtered); return this.flatOptions(filtered);

View File

@ -1093,9 +1093,10 @@ export default {
const filtered = []; const filtered = [];
optionGroups.forEach((group) => { optionGroups.forEach((group) => {
const filteredItems = group.items.filter((item) => filteredOptions.includes(item)); const groupChildren = this.getOptionGroupChildren(group);
const filteredItems = groupChildren.filter((item) => filteredOptions.includes(item));
if (filteredItems.length > 0) filtered.push({ ...group, items: [...filteredItems] }); if (filteredItems.length > 0) filtered.push({ ...group, [typeof this.optionGroupChildren === 'string' ? this.optionGroupChildren : 'items']: [...filteredItems] });
}); });
return this.flatOptions(filtered); return this.flatOptions(filtered);