From 991a243c9dd0a4dbc73341b938049a6a1c3e33bd Mon Sep 17 00:00:00 2001 From: Davide Iadeluca <146922689+DavideIadeluca@users.noreply.github.com> Date: Mon, 10 Feb 2025 07:45:15 +0100 Subject: [PATCH] refactor: make search debounce time extensible (#4171) --- framework/core/js/src/forum/components/Search.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/core/js/src/forum/components/Search.tsx b/framework/core/js/src/forum/components/Search.tsx index 07fca3f45..5f55819c2 100644 --- a/framework/core/js/src/forum/components/Search.tsx +++ b/framework/core/js/src/forum/components/Search.tsx @@ -59,6 +59,11 @@ export default class Search extends Compone */ protected static MIN_SEARCH_LEN = 3; + /** + * Time to wait (in milliseconds) after the user stops typing before triggering a search. + */ + protected static SEARCH_DEBOUNCE_TIME_MS = 250; + /** * The instance of `SearchState` for this component. */ @@ -258,7 +263,7 @@ export default class Search extends Compone state.cache(query); m.redraw(); - }, 250); + }, (search.constructor as typeof Search).SEARCH_DEBOUNCE_TIME_MS); }) .on('focus', function () {