Filter out short searches less then 2 chars, bigger debounce (#2440)

This commit is contained in:
Scott Cazan
2024-09-03 14:49:35 +02:00
committed by GitHub
parent 4a7613a521
commit 4336bc20e0
2 changed files with 5 additions and 1 deletions
@@ -98,7 +98,7 @@ export const SearchResults = React.forwardRef(function SearchResults(
: searchSpaceContent(spaceId, revisionId, query));
setResults(withAsk ? withQuestionResult(fetchedResults, query) : fetchedResults);
}, 250);
}, 350);
return () => {
if (debounceTimeout.current) {
@@ -60,6 +60,10 @@ export async function searchSiteContent(args: {
const { siteSpaceIds, query, cacheBust } = args;
const pointer = getContentPointer();
if (query.length <= 1) {
return [];
}
if (siteSpaceIds?.length === 0) {
// if we have no siteSpaces to search in then we won't find anything. skip the call.
return [];