Show loading state while fetching suggestions
This commit is contained in:
+6
-2
@@ -458,6 +458,12 @@
|
|||||||
clearTimeout(this._suggestTimer);
|
clearTimeout(this._suggestTimer);
|
||||||
const prefix = ctx.prefix;
|
const prefix = ctx.prefix;
|
||||||
if (prefix && prefix.length >= 2) {
|
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);
|
this._suggestTimer = setTimeout(() => this._fetchSuggestions(prefix, vault), 150);
|
||||||
} else {
|
} else {
|
||||||
this._renderTitles([], "");
|
this._renderTitles([], "");
|
||||||
@@ -468,8 +474,6 @@
|
|||||||
|
|
||||||
// Show/hide sections
|
// Show/hide sections
|
||||||
this._historySection.hidden = historyItems.length === 0;
|
this._historySection.hidden = historyItems.length === 0;
|
||||||
this._titlesSection.hidden = true;
|
|
||||||
this._tagsSection.hidden = true;
|
|
||||||
const hasContent = historyItems.length > 0;
|
const hasContent = historyItems.length > 0;
|
||||||
if (hasContent || (prefix && prefix.length >= 2)) {
|
if (hasContent || (prefix && prefix.length >= 2)) {
|
||||||
this.show();
|
this.show();
|
||||||
|
|||||||
Reference in New Issue
Block a user