From 5208df4a280af31c777af969644b4995bb4cc621 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 23 Mar 2023 21:49:09 +0800 Subject: [PATCH] Fix filter logic --- src/utils/filters.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/filters.jsx b/src/utils/filters.jsx index eda2d3fb..d609ad1e 100644 --- a/src/utils/filters.jsx +++ b/src/utils/filters.jsx @@ -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 [];