adjust search debounce

This commit is contained in:
Nate Kelley 2025-04-14 13:08:55 -06:00
parent e1344fcfa6
commit 3ee2fc8281
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import { search } from '../buster_rest/search';
export const getSearchResult = (params: Parameters<typeof search>[0]) =>
queryOptions<BusterSearchResult[]>({
queryKey: ['search', 'results', params] as const,
staleTime: 1000 * 45 // 45 seconds,
staleTime: 1000 * 15 // 15 seconds,
});
export const searchQueryKeys = {

View File

@ -20,7 +20,8 @@ export const AddToCollectionModal: React.FC<{
const { mutateAsync: addAndRemoveAssetsFromCollection } = useAddAndRemoveAssetsFromCollection();
const [searchTerm, setSearchTerm] = useState('');
const debouncedSearchTerm = useDebounce(searchTerm, { wait: 100 });
const debouncedSearchTerm = useDebounce(searchTerm, { wait: 200 });
const { data: searchResults } = useSearch({
query: debouncedSearchTerm,
asset_types: ['metric', 'dashboard'],

View File

@ -16,7 +16,7 @@ export const AddToDashboardModal: React.FC<{
const [searchTerm, setSearchTerm] = useState('');
const [selectedMetrics, setSelectedMetrics] = useState<string[]>([]);
const debouncedSearchTerm = useDebounce(searchTerm, { wait: 100 });
const debouncedSearchTerm = useDebounce(searchTerm, { wait: 175 });
const { data: searchResults } = useSearch(
{