diff --git a/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx index 461bcef8a..94da0611a 100644 --- a/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx @@ -33,7 +33,7 @@ export const AppearanceTab = ({ label={t('appearance.icon.label')} description={t('appearance.icon.description')} variant="default" - data={isLoading ? [] : data.files} + data={data.files ?? []} withAsterisk required {...form.getInputProps('appearance.iconUrl')} diff --git a/src/components/Dashboard/Wrappers/Category/useCategoryActions.tsx b/src/components/Dashboard/Wrappers/Category/useCategoryActions.tsx index 925f825be..2ea0698ee 100644 --- a/src/components/Dashboard/Wrappers/Category/useCategoryActions.tsx +++ b/src/components/Dashboard/Wrappers/Category/useCategoryActions.tsx @@ -184,7 +184,7 @@ export const useCategoryActions = (configName: string | undefined, category: Cat if (!configName) return; updateConfig( configName, - (previous): ConfigType => { + (previous) => { const currentItem = previous.categories.find((x) => x.id === category.id); if (!currentItem) return previous; // Find the main wrapper diff --git a/src/components/layout/header/Search.tsx b/src/components/layout/header/Search.tsx index f927e2dd4..bf9753425 100644 --- a/src/components/layout/header/Search.tsx +++ b/src/components/layout/header/Search.tsx @@ -140,10 +140,13 @@ export function Search() { const openInNewTab = config?.settings.common.searchEngine.properties.openInNewTab ? '_blank' : '_self'; - const [OverseerrResults, setOverseerrResults] = useState([]); const [opened, setOpened] = useState(false); - const { data, isLoading, error } = useQuery( + const { + data: OverseerrResults, + isLoading, + error, + } = useQuery( ['overseerr', debounced], async () => { if (debounced !== '' && selectedSearchEngine.value === 'overseerr' && debounced.length > 3) { @@ -159,10 +162,6 @@ export function Search() { } ); - useEffect(() => { - setOverseerrResults(data ?? []); - }, [data]); - const isModuleEnabled = config?.settings.customization.layout.enabledSearchbar; if (!isModuleEnabled) { return null; @@ -172,7 +171,7 @@ export function Search() { return ( 0 && opened && searchQuery.length > 3} + opened={OverseerrResults && OverseerrResults.length > 0 && opened && searchQuery.length > 3} position="bottom" withinPortal shadow="md" @@ -221,10 +220,12 @@ export function Search() { - {OverseerrResults.slice(0, 4).map((result, index) => ( + {OverseerrResults && OverseerrResults.slice(0, 4).map((result: any, index: number) => ( - {index < OverseerrResults.length - 1 && index < 3 && } + {index < OverseerrResults.length - 1 && index < 3 && ( + + )} ))}