Skip to content

Commit c7afd8f

Browse files
refactor: make search debounce time extensible
1 parent b028314 commit c7afd8f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

framework/core/js/src/forum/components/Search.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
5959
*/
6060
protected static MIN_SEARCH_LEN = 3;
6161

62+
/**
63+
* Time to wait (in milliseconds) after the user stops typing before triggering a search.
64+
*/
65+
protected static SEARCH_DEBOUNCE_TIME_MS = 250;
66+
6267
/**
6368
* The instance of `SearchState` for this component.
6469
*/
@@ -258,7 +263,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
258263

259264
state.cache(query);
260265
m.redraw();
261-
}, 250);
266+
}, (search.constructor as typeof Search).SEARCH_DEBOUNCE_TIME_MS);
262267
})
263268

264269
.on('focus', function () {

0 commit comments

Comments
 (0)