Ignore filters only while searching (#256)
In case the "ignoreFilters" flag was set to true and the search string was empty/undefined all mangas of the category were visible, ignoring the set filters.
This commit is contained in:
@@ -56,11 +56,14 @@ const filterManga = (
|
|||||||
downloaded: NullAndUndefined<boolean>,
|
downloaded: NullAndUndefined<boolean>,
|
||||||
ignoreFilters: boolean,
|
ignoreFilters: boolean,
|
||||||
): IMangaCard[] =>
|
): IMangaCard[] =>
|
||||||
mangas.filter(
|
mangas.filter((manga) => {
|
||||||
(manga) =>
|
const ignoreFiltersWhileSearching = ignoreFilters && query?.length;
|
||||||
(queryFilter(query, manga) || queryGenreFilter(query, manga)) &&
|
const matchesSearch = queryFilter(query, manga) || queryGenreFilter(query, manga);
|
||||||
(ignoreFilters || (downloadedFilter(downloaded, manga) && unreadFilter(unread, manga))),
|
const matchesFilters =
|
||||||
);
|
ignoreFiltersWhileSearching || (downloadedFilter(downloaded, manga) && unreadFilter(unread, manga));
|
||||||
|
|
||||||
|
return matchesSearch && matchesFilters;
|
||||||
|
});
|
||||||
|
|
||||||
const sortByUnread = (a: IMangaCard, b: IMangaCard): number =>
|
const sortByUnread = (a: IMangaCard, b: IMangaCard): number =>
|
||||||
// eslint-disable-next-line implicit-arrow-linebreak
|
// eslint-disable-next-line implicit-arrow-linebreak
|
||||||
|
|||||||
Reference in New Issue
Block a user