From 26e44f47cab4966c927098bbb15f6de94fe52bed Mon Sep 17 00:00:00 2001 From: David Sevilla Martin <6401250+datitisev@users.noreply.github.com> Date: Sat, 30 Oct 2021 19:13:43 -0400 Subject: [PATCH] Switch to constructor MIN_SEARCH_LENGTH in Search component (#3130) --- framework/core/js/src/forum/components/Search.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/core/js/src/forum/components/Search.tsx b/framework/core/js/src/forum/components/Search.tsx index b4793eab4..bba6dba0b 100644 --- a/framework/core/js/src/forum/components/Search.tsx +++ b/framework/core/js/src/forum/components/Search.tsx @@ -52,7 +52,10 @@ export interface SearchAttrs extends ComponentAttrs { * - state: SearchState instance. */ export default class Search extends Component { - static MIN_SEARCH_LEN = 3; + /** + * The minimum query length before sources are searched. + */ + protected static MIN_SEARCH_LEN = 3; protected state!: SearchState; @@ -211,7 +214,7 @@ export default class Search extends Compone search.searchTimeout = setTimeout(() => { if (state.isCached(query)) return; - if (query.length >= Search.MIN_SEARCH_LEN) { + if (query.length >= (search.constructor as typeof Search).MIN_SEARCH_LEN) { search.sources.map((source) => { if (!source.search) return;