From 5caf22e19ac8cda5005e7b3711b6d71536facca3 Mon Sep 17 00:00:00 2001 From: ajnart Date: Wed, 30 Nov 2022 00:42:10 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20changing=20search=20engine?= =?UTF-8?q?=20doesn't=20apply=20to=20search=20bar=20#521?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/search/SearchModule.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/search/SearchModule.tsx b/src/modules/search/SearchModule.tsx index 0842272a4..2af962eed 100644 --- a/src/modules/search/SearchModule.tsx +++ b/src/modules/search/SearchModule.tsx @@ -53,7 +53,6 @@ export function SearchModuleComponent() { const { t } = useTranslation('modules/search'); const [searchQuery, setSearchQuery] = useState(''); const [debounced, cancel] = useDebouncedValue(searchQuery, 250); - const queryUrl = config.settings.searchUrl; const isOverseerrEnabled = config.modules?.[OverseerrModule.id]?.enabled ?? false; const OverseerrService = config.services.find( (service) => service.type === 'Overseerr' || service.type === 'Jellyseerr' @@ -66,7 +65,7 @@ export function SearchModuleComponent() { label: t('searchEngines.search.name'), value: 'search', description: t('searchEngines.search.description'), - url: queryUrl, + url: config.settings.searchUrl, shortcut: 's', }, { @@ -98,6 +97,10 @@ export function SearchModuleComponent() { }, ]; const [selectedSearchEngine, setSearchEngine] = useState(searchEnginesList[0]); + useEffect(() => { + // Refresh the default search engine every time the config for it changes #521 + setSearchEngine(searchEnginesList[0]); + }, [config.settings.searchUrl]); const textInput = useRef(null); useHotkeys([['mod+K', () => textInput.current && textInput.current.focus()]]); const { classes } = useStyles();