mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-09 15:05:48 +01:00
♻️ Pull request feedback
This commit is contained in:
@@ -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')}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -140,10 +140,13 @@ export function Search() {
|
||||
const openInNewTab = config?.settings.common.searchEngine.properties.openInNewTab
|
||||
? '_blank'
|
||||
: '_self';
|
||||
const [OverseerrResults, setOverseerrResults] = useState<any[]>([]);
|
||||
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 (
|
||||
<Box style={{ width: '100%', maxWidth: 400 }}>
|
||||
<Popover
|
||||
opened={OverseerrResults.length > 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() {
|
||||
</Popover.Target>
|
||||
<Popover.Dropdown>
|
||||
<ScrollArea style={{ height: '80vh', maxWidth: '90vw' }} offsetScrollbars>
|
||||
{OverseerrResults.slice(0, 4).map((result, index) => (
|
||||
{OverseerrResults && OverseerrResults.slice(0, 4).map((result: any, index: number) => (
|
||||
<React.Fragment key={index}>
|
||||
<OverseerrMediaDisplay key={result.id} media={result} />
|
||||
{index < OverseerrResults.length - 1 && index < 3 && <Divider variant="dashed" my="xs" />}
|
||||
{index < OverseerrResults.length - 1 && index < 3 && (
|
||||
<Divider variant="dashed" my="xs" />
|
||||
)}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</ScrollArea>
|
||||
|
||||
Reference in New Issue
Block a user