From 34bd00e63e3904e77143820d45efed0f90e14e14 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Wed, 25 Sep 2024 19:58:55 +0800 Subject: [PATCH] Provide defaults if setting is undefined --- src/hooks/persisted/useSettings.ts | 2 +- src/screens/GlobalSearchScreen/hooks/useGlobalSearch.ts | 2 +- src/screens/browse/settings/BrowseSettings.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hooks/persisted/useSettings.ts b/src/hooks/persisted/useSettings.ts index 215c7f44f..e1c91a571 100644 --- a/src/hooks/persisted/useSettings.ts +++ b/src/hooks/persisted/useSettings.ts @@ -56,7 +56,7 @@ export interface AppSettings { export interface BrowseSettings { showMyAnimeList: boolean; showAniList: boolean; - globalSearchConcurrency: number; + globalSearchConcurrency?: number; } export interface LibrarySettings { diff --git a/src/screens/GlobalSearchScreen/hooks/useGlobalSearch.ts b/src/screens/GlobalSearchScreen/hooks/useGlobalSearch.ts index 9d7615943..18a1d2e3f 100644 --- a/src/screens/GlobalSearchScreen/hooks/useGlobalSearch.ts +++ b/src/screens/GlobalSearchScreen/hooks/useGlobalSearch.ts @@ -29,7 +29,7 @@ export const useGlobalSearch = ({ defaultSearchText }: Props) => { const [searchResults, setSearchResults] = useState([]); const [progress, setProgress] = useState(0); - const { globalSearchConcurrency } = useBrowseSettings(); + const { globalSearchConcurrency = 5 } = useBrowseSettings(); const globalSearch = (searchText: string) => { const defaultResult: GlobalSearchResult[] = filteredInstalledPlugins.map( diff --git a/src/screens/browse/settings/BrowseSettings.tsx b/src/screens/browse/settings/BrowseSettings.tsx index dc9ee326a..f1bccdde0 100644 --- a/src/screens/browse/settings/BrowseSettings.tsx +++ b/src/screens/browse/settings/BrowseSettings.tsx @@ -35,7 +35,7 @@ const BrowseSettings = ({ navigation }: BrowseSettingsScreenProp) => { theme={theme} /> {