Fix filter logic

pull/86/head
Lim Chee Aun 2023-03-23 21:49:09 +08:00
rodzic 6685549d11
commit 5208df4a28
1 zmienionych plików z 5 dodań i 3 usunięć

Wyświetl plik

@ -13,8 +13,10 @@ export function filteredItem(item, filterContext, currentAccountID) {
return new Date(filter.expiresAt) > new Date();
});
const isHidden = appliedFilters.some((f) => f.filter.filterAction === 'hide');
console.log({ isHidden, filtered, appliedFilters });
if (!isHidden) {
console.log({ isHidden, filtered, appliedFilters, item });
if (isHidden) return false;
const isWarn = appliedFilters.some((f) => f.filter.filterAction === 'warn');
if (isWarn) {
const filterTitles = appliedFilters.map((f) => f.filter.title);
item._filtered = {
titles: filterTitles,
@ -22,7 +24,7 @@ export function filteredItem(item, filterContext, currentAccountID) {
};
item._test = { test: 'test' };
}
return !isHidden;
return isWarn;
}
export function filteredItems(items, filterContext) {
if (!items?.length) return [];