fixed bugs:

- suppressed display of search results if nothing was found but there were previous searches
- improved display timing of search results/initial pages, which led to false displays
This commit is contained in:
J-Klinke 2024-07-05 12:30:40 +02:00
parent 49eda4ce0a
commit 15f743d8ab
3 changed files with 8 additions and 5 deletions

View File

@ -17,8 +17,10 @@ export function fetchQuery(fetchString, clearResults) {
function parseContent(content, clearResults) {
if (content.length === 0) {
searchSection.querySelector("#nothing-found ").classList.remove("hidden");
searchSection.querySelector(".datasets").classList.add("hidden");
} else {
searchSection.querySelector("#nothing-found").classList.add("hidden");
searchSection.querySelector(".datasets").classList.remove("hidden");
const datasets = content.map(dataset => new Dataset(dataset));
if (clearResults) {
Array.from(searchSection.querySelectorAll(".datasets .dataset")).forEach(e => e.remove());

View File

@ -78,10 +78,6 @@ header {
text-align: center;
}
.hidden {
display: none;
}
#search-entry:focus-visible {
outline: none;
}
@ -93,6 +89,11 @@ header {
gap: 1rem;
}
.hidden {
display: none;
}
@container (width < 60ch) {
.datasets {
grid-template-columns: 1fr;

View File

@ -47,10 +47,10 @@ searchButton.addEventListener("click", () => {
});
searchBar.addEventListener("input", () => {
updateSections();
clearTimeout(searchBarTimeout);
searchBarTimeout = setTimeout(() => {
fetchQuery(createQuery(), true);
updateSections();
}, searchDelay);
});