1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Reduce requests for issue ID, username, and Wiki page name autocomplete with debounce (#43208).

Patch by Katsuya HIDAKA (user:hidakatsuya).


git-svn-id: https://svn.redmine.org/redmine/trunk@23978 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2025-09-16 23:41:08 +00:00
parent 7b5eeb0cb4
commit 7d6224979f

View File

@ -1257,7 +1257,17 @@ function inlineAutoComplete(element) {
}
}
const remoteSearch = function(url, cb) {
const debounce = function(func, delay) {
let timeout;
return function(...args) {
const context = this;
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(context, args), delay);
};
}
const remoteSearch = debounce((url, cb) => {
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function ()
{
@ -1272,7 +1282,7 @@ function inlineAutoComplete(element) {
};
xhr.open("GET", url, true);
xhr.send();
};
}, 200);
const tribute = new Tribute({
collection: [