mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 03:18:23 +00:00
FIX: correctly always return a promise from loadMore (#19676)
This commit also fixes an issue where `loading = false` was never called when the server had nothing new to return.
This commit is contained in:
parent
2f61d26e3d
commit
cb2f684a43
@ -71,19 +71,19 @@ class Collection {
|
||||
|
||||
@bind
|
||||
loadMore() {
|
||||
let promise = Promise.resolve();
|
||||
|
||||
if (this.loading) {
|
||||
return;
|
||||
return promise;
|
||||
}
|
||||
|
||||
if (
|
||||
this._fetchedAll ||
|
||||
(this.totalRows && this.items.length >= this.totalRows)
|
||||
) {
|
||||
return;
|
||||
return promise;
|
||||
}
|
||||
|
||||
let promise;
|
||||
|
||||
this.loading = true;
|
||||
|
||||
if (this.loadMoreURL) {
|
||||
@ -97,8 +97,6 @@ class Collection {
|
||||
}
|
||||
this.meta = result.meta;
|
||||
});
|
||||
} else {
|
||||
promise = Promise.resolve();
|
||||
}
|
||||
|
||||
return promise.finally(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user