From d48edeb5a9bd8e2edce8bca0fea50e300bb7a1ae Mon Sep 17 00:00:00 2001 From: sct Date: Thu, 11 Mar 2021 05:01:52 +0000 Subject: [PATCH] fix(frontend): never hide available content in search results --- src/components/Search/index.tsx | 10 +++++++--- src/hooks/useDiscover.ts | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index ff2f28f28..e36442cf2 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -29,9 +29,13 @@ const Search: React.FC = () => { titles, fetchMore, error, - } = useDiscover(`/api/v1/search`, { - query: router.query.query, - }); + } = useDiscover( + `/api/v1/search`, + { + query: router.query.query, + }, + { hideAvailable: false } + ); if (error) { return ; diff --git a/src/hooks/useDiscover.ts b/src/hooks/useDiscover.ts index 3bb73a3c3..ecba66893 100644 --- a/src/hooks/useDiscover.ts +++ b/src/hooks/useDiscover.ts @@ -31,7 +31,8 @@ interface DiscoverResult { const useDiscover = >( endpoint: string, - options?: Record + options?: Record, + { hideAvailable = true } = {} ): DiscoverResult => { const settings = useSettings(); const { locale } = useContext(LanguageContext); @@ -74,7 +75,7 @@ const useDiscover = >( let titles = (data ?? []).reduce((a, v) => [...a, ...v.results], [] as T[]); - if (settings.currentSettings.hideAvailable) { + if (settings.currentSettings.hideAvailable && hideAvailable) { titles = titles.filter( (i) => (i.mediaType === 'movie' || i.mediaType === 'tv') &&