From b474843cc2bd5452f9ec349000b98485b8ca11c0 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 14 Nov 2018 11:38:28 +1030 Subject: [PATCH] Clear the search loading indicator after pressing Enter --- js/src/forum/components/Search.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/forum/components/Search.js b/js/src/forum/components/Search.js index ea1fefb56..2a2ba925d 100644 --- a/js/src/forum/components/Search.js +++ b/js/src/forum/components/Search.js @@ -160,7 +160,7 @@ export default class Search extends Component { search.loadingSources++; source.search(query).then(() => { - search.loadingSources--; + search.loadingSources = Math.max(0, search.loadingSources - 1); m.redraw(); }); }); @@ -189,6 +189,9 @@ export default class Search extends Component { * Navigate to the currently selected search result and close the list. */ selectResult() { + clearTimeout(this.searchTimeout); + this.loadingSources = 0; + if (this.value()) { m.route(this.getItem(this.index).find('a').attr('href')); } else {