1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 16:36:47 +02:00

Make min search length a constant

This commit is contained in:
Matthew Kilgore
2020-11-23 23:31:26 -05:00
parent 47e8990813
commit 1eb316bf44

View File

@@ -21,6 +21,8 @@ import UsersSearchSource from './UsersSearchSource';
* - state: SearchState instance.
*/
export default class Search extends Component {
static MIN_SEARCH_LEN = 3;
oninit(vnode) {
super.oninit(vnode);
this.state = this.attrs.state;
@@ -152,7 +154,7 @@ export default class Search extends Component {
search.searchTimeout = setTimeout(() => {
if (state.isCached(query)) return;
if (query.length >= 3) {
if (query.length >= Search.MIN_SEARCH_LEN) {
search.sources.map((source) => {
if (!source.search) return;