mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/13713] Fix issue with duplicate queries
PHPBB3-13713
This commit is contained in:
parent
2bb50add04
commit
783449d626
1 changed files with 11 additions and 0 deletions
|
@ -387,6 +387,7 @@ function getCaretPosition(txtarea) {
|
||||||
(function($) {
|
(function($) {
|
||||||
function Mentions() {
|
function Mentions() {
|
||||||
let $mentionDataContainer = $('[data-mention-url]:first');
|
let $mentionDataContainer = $('[data-mention-url]:first');
|
||||||
|
let queryInProgress = null;
|
||||||
let cachedNames = null;
|
let cachedNames = null;
|
||||||
let cachedFor = null;
|
let cachedFor = null;
|
||||||
let cachedSearchKey = 'name';
|
let cachedSearchKey = 'name';
|
||||||
|
@ -449,10 +450,20 @@ function getCaretPosition(txtarea) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do not make a new request until the previous one for the same query is returned
|
||||||
|
* This fixes duplicate server queries e.g. when arrow keys are pressed
|
||||||
|
*/
|
||||||
|
if (queryInProgress === query) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
queryInProgress = query;
|
||||||
|
|
||||||
let params = {keyword: query, topic_id: mentionTopicId, _referer: location.href};
|
let params = {keyword: query, topic_id: mentionTopicId, _referer: location.href};
|
||||||
$.getJSON(mentionURL, params, function (data) {
|
$.getJSON(mentionURL, params, function (data) {
|
||||||
cachedNames = data;
|
cachedNames = data;
|
||||||
cachedFor = query;
|
cachedFor = query;
|
||||||
|
queryInProgress = null;
|
||||||
callback(data);
|
callback(data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue