mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-26 04:09:57 +00:00
fix: do not update datalist if search substring hasn't changed
This commit is contained in:
@ -148,8 +148,19 @@
|
|||||||
|
|
||||||
packageAddInput.addEventListener("keyup", _ => {
|
packageAddInput.addEventListener("keyup", _ => {
|
||||||
clearTimeout(packageAddInput.requestTimeout);
|
clearTimeout(packageAddInput.requestTimeout);
|
||||||
packageAddInput.requestTimeout = setTimeout(_ => {
|
|
||||||
|
// do not update datalist if search string didn't change yet
|
||||||
const value = packageAddInput.value;
|
const value = packageAddInput.value;
|
||||||
|
const previousValue = packageAddInput.dataset.previousValue;
|
||||||
|
if (value === previousValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// store current search string in attributes
|
||||||
|
packageAddInput.dataset.previousValue = value;
|
||||||
|
|
||||||
|
// perform data list update
|
||||||
|
packageAddInput.requestTimeout = setTimeout(_ => {
|
||||||
|
|
||||||
if (value.length >= 3) {
|
if (value.length >= 3) {
|
||||||
makeRequest(
|
makeRequest(
|
||||||
|
Reference in New Issue
Block a user