Show loading state while fetching suggestions
This commit is contained in:
parent
e5b5f2d4f4
commit
56b2a004f9
@ -458,6 +458,12 @@
|
||||
clearTimeout(this._suggestTimer);
|
||||
const prefix = ctx.prefix;
|
||||
if (prefix && prefix.length >= 2) {
|
||||
// Show placeholder while loading
|
||||
this._titlesList.innerHTML = '<li class="search-dropdown__item search-dropdown__item--loading">Recherche...</li>';
|
||||
this._tagsList.innerHTML = '<li class="search-dropdown__item search-dropdown__item--loading">Recherche...</li>';
|
||||
this._titlesSection.hidden = false;
|
||||
this._tagsSection.hidden = false;
|
||||
this.show();
|
||||
this._suggestTimer = setTimeout(() => this._fetchSuggestions(prefix, vault), 150);
|
||||
} else {
|
||||
this._renderTitles([], "");
|
||||
@ -468,8 +474,6 @@
|
||||
|
||||
// Show/hide sections
|
||||
this._historySection.hidden = historyItems.length === 0;
|
||||
this._titlesSection.hidden = true;
|
||||
this._tagsSection.hidden = true;
|
||||
const hasContent = historyItems.length > 0;
|
||||
if (hasContent || (prefix && prefix.length >= 2)) {
|
||||
this.show();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user