Improve loading for tags

When opening the tag select and type something the tags are loaded.

If you continue to type but the tags are not finally loaded yet (the first xhr request is still running)
another xhr request is triggered. This happens for every keystroke.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
pull/34096/head
Daniel Kesselberg 2022-09-15 11:57:23 +07:00
parent e1d9b0bae2
commit 1bfac6d094
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
1 changed files with 4 additions and 1 deletions

@ -69,7 +69,7 @@
fetch: function(options) {
var self = this
options = options || {}
if (this.fetched || options.force) {
if (this.fetched || this.working || options.force) {
// directly call handler
if (options.success) {
options.success(this, null, options)
@ -79,10 +79,13 @@
return Promise.resolve()
}
this.working = true
var success = options.success
options = _.extend({}, options)
options.success = function() {
self.fetched = true
self.working = false
if (success) {
return success.apply(this, arguments)
}