Make search a little more responseive, hopefully

This commit is contained in:
2024-08-14 12:52:11 +02:00
parent f12c353905
commit 4abddac94f

View File

@@ -30,6 +30,18 @@
name = name.trim();
if (!name) {
foodSearch = [];
} else {
if (!per100Edited)
GetLastPer100(name.trim()).then((res) => {
// Prevent search when there's nothing to search
// Sometimes we get search results after deleting name
console.log(name.trim(), res);
if (res.success && res.data && name) {
foodSearch = res.data;
} else {
foodSearch = [];
}
});
}
}
@@ -69,17 +81,6 @@
nameElement.focus();
foodSearch = [];
}
if (!per100Edited)
GetLastPer100(name.trim()).then((res) => {
// Prevent search when there's nothing to search
// Sometimes we get search results after deleting name
if (res.success && res.data && name) {
foodSearch = res.data;
} else {
foodSearch = [];
}
});
}
let hiLiteIndex: number | null = null;