Fixed a bug, subitems were always showing

This commit is contained in:
DrMint 2022-05-13 19:23:34 +02:00
parent 81c8cf08fb
commit 16891dfad1
1 changed files with 1 additions and 3 deletions

View File

@ -369,8 +369,7 @@ function filterItems(
showSecondaryItems: boolean, showSecondaryItems: boolean,
items: Immutable<Props["items"]> items: Immutable<Props["items"]>
): Immutable<Props["items"]> { ): Immutable<Props["items"]> {
const fileredItems = [...items] as Props["items"]; return [...items].filter((item) => {
fileredItems.filter((item) => {
if (!showSubitems && !item.attributes?.root_item) return false; if (!showSubitems && !item.attributes?.root_item) return false;
if ( if (
showSubitems && showSubitems &&
@ -385,7 +384,6 @@ function filterItems(
if (!item.attributes?.primary && !showSecondaryItems) return false; if (!item.attributes?.primary && !showSecondaryItems) return false;
return true; return true;
}); });
return fileredItems as Immutable<Props["items"]>;
} }
function sortBy( function sortBy(