Add cache and stale timers for most react query

This commit is contained in:
ajnart
2023-01-31 11:45:52 +09:00
parent e9eebadce6
commit 6586cdd060
8 changed files with 45 additions and 31 deletions

View File

@@ -148,13 +148,14 @@ export function Search() {
} = useQuery(
['overseerr', debounced],
async () => {
if (debounced !== '' && selectedSearchEngine.value === 'overseerr' && debounced.length > 3) {
const res = await axios.get(`/api/modules/overseerr?query=${debounced}`);
return res.data.results ?? [];
}
return [];
const res = await axios.get(`/api/modules/overseerr?query=${debounced}`);
return res.data.results ?? [];
},
{
enabled:
isOverseerrEnabled === true &&
selectedSearchEngine.value === 'overseerr' &&
debounced.length > 3,
refetchOnWindowFocus: false,
refetchOnMount: false,
refetchInterval: false,