Search: bump live-search debounce 300ms -> 600ms (#751)

Reporter (Vicky-2418) saw the artist search fire a separate external-API
search for nearly every letter typed. There WAS a 300ms debounce, but that's
short enough that a deliberately-typed name lands a keystroke per debounce
window, so each letter kicked off (and aborted) a fresh search — noisy in the
logs and wasteful.

Bumped both live-search surfaces that drive the shared SearchController
(external metadata APIs) to 600ms: the /search enhanced input (search.js) and
the global-search widget (downloads.js). 600ms coalesces a name being typed
into one search after the user pauses, while still feeling live. Enter still
triggers an immediate search on both (existing keypress/keydown handlers),
and the per-change abort already cancels stale in-flight fetches.

Frontend-only; both files syntax-clean.
This commit is contained in:
BoulderBadgeDad 2026-05-30 15:34:34 -07:00
parent 401b3ed327
commit fa750b6e89
2 changed files with 9 additions and 3 deletions

View file

@ -5658,7 +5658,10 @@ let _gsController = null;
if (clearBtn) clearBtn.style.display = q.length > 0 ? '' : 'none';
if (_gsState.debounceTimer) clearTimeout(_gsState.debounceTimer);
if (q.length < 2) { _gsHideResults(); return; }
_gsState.debounceTimer = setTimeout(() => _gsController.submitQuery(q), 300);
// 600ms (was 300) — coalesce a name being typed into one search
// instead of one external-API search per letter (#751). Enter still
// fires immediately via the keydown handler.
_gsState.debounceTimer = setTimeout(() => _gsController.submitQuery(q), 600);
});
if (clearBtn) {

View file

@ -243,10 +243,13 @@ function initializeSearchModeToggle() {
return;
}
// Debounce search
// Debounce search. 600ms (was 300) so a name being typed coalesces
// into ONE search after the user pauses, instead of firing a new
// external-API search per letter (#751). Enter still triggers an
// immediate search via the keypress handler below.
debounceTimer = setTimeout(() => {
searchController.submitQuery(query);
}, 300);
}, 600);
});
enhancedInput.addEventListener('keypress', (e) => {