Make search a little more responseive, hopefully
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user