mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 19:29:51 +00:00
FIX: remove racing requests for admin users (#15936)
This commit is contained in:
parent
704606e731
commit
a0f4c7fe88
@ -17,6 +17,7 @@ export default Controller.extend(CanCheckEmails, {
|
|||||||
listFilter: null,
|
listFilter: null,
|
||||||
selectAll: false,
|
selectAll: false,
|
||||||
searchHint: i18n("search_hint"),
|
searchHint: i18n("search_hint"),
|
||||||
|
_searchIndex: 0,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
@ -48,6 +49,8 @@ export default Controller.extend(CanCheckEmails, {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._searchIndex++;
|
||||||
|
const searchIndex = this._searchIndex;
|
||||||
this.set("refreshing", true);
|
this.set("refreshing", true);
|
||||||
|
|
||||||
AdminUser.findAll(this.query, {
|
AdminUser.findAll(this.query, {
|
||||||
@ -58,6 +61,10 @@ export default Controller.extend(CanCheckEmails, {
|
|||||||
page: this._page,
|
page: this._page,
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
if (this.ignoreResponse(searchIndex)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!result || result.length === 0) {
|
if (!result || result.length === 0) {
|
||||||
this._canLoadMore = false;
|
this._canLoadMore = false;
|
||||||
}
|
}
|
||||||
@ -65,7 +72,18 @@ export default Controller.extend(CanCheckEmails, {
|
|||||||
this._results = this._results.concat(result);
|
this._results = this._results.concat(result);
|
||||||
this.set("model", this._results);
|
this.set("model", this._results);
|
||||||
})
|
})
|
||||||
.finally(() => this.set("refreshing", false));
|
.finally(() => {
|
||||||
|
if (this.ignoreResponse(searchIndex)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.set("refreshing", false);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
ignoreResponse(searchIndex) {
|
||||||
|
return (
|
||||||
|
searchIndex !== this._searchIndex || this.isDestroyed || this.isDestroying
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user