site: bind search component open to items.length

This commit is contained in:
Lucas Gabriel Vuotto 2025-04-28 15:58:00 +00:00
parent cc25efc5f4
commit bf21610576
2 changed files with 4 additions and 5 deletions

View file

@ -25,7 +25,7 @@ document.addEventListener('alpine:init', () => {
return;
if (currentWord === this.currentWord) {
/* Show previous items, if any. */
this.open = true;
this.open = this.items.length > 0;
return;
}
this.currentWord = currentWord;
@ -35,12 +35,13 @@ document.addEventListener('alpine:init', () => {
if (!response.ok) {
this.items = [];
this.open = false;
return;
}
this.activeItem = null;
this.items = await response.json();
this.open = true;
this.open = this.items.length > 0;
},
async fetchSuggestionsOnInput(evt) {