Improve paging
This commit is contained in:
parent
52fb1237ec
commit
3d79e7a136
2 changed files with 2 additions and 3 deletions
|
@ -67,7 +67,7 @@ export default (opts) => ({
|
||||||
...params,
|
...params,
|
||||||
limit: this.pagination.noPaging ? (this.pagination.limit || 10) : (this.pagination.limit || 10) + 1,
|
limit: this.pagination.noPaging ? (this.pagination.limit || 10) : (this.pagination.limit || 10) + 1,
|
||||||
}).then(items => {
|
}).then(items => {
|
||||||
if (!this.pagination.noPaging && (items.length === (this.pagination.limit || 10) + 1)) {
|
if (!this.pagination.noPaging && (items.length > (this.pagination.limit || 10))) {
|
||||||
items.pop();
|
items.pop();
|
||||||
this.items = this.pagination.reversed ? [...items].reverse() : items;
|
this.items = this.pagination.reversed ? [...items].reverse() : items;
|
||||||
this.more = true;
|
this.more = true;
|
||||||
|
@ -103,7 +103,7 @@ export default (opts) => ({
|
||||||
untilId: this.items[this.items.length - 1].id,
|
untilId: this.items[this.items.length - 1].id,
|
||||||
}),
|
}),
|
||||||
}).then(items => {
|
}).then(items => {
|
||||||
if (items.length === SECOND_FETCH_LIMIT + 1) {
|
if (items.length > SECOND_FETCH_LIMIT) {
|
||||||
items.pop();
|
items.pop();
|
||||||
this.items = this.pagination.reversed ? [...items].reverse().concat(this.items) : this.items.concat(items);
|
this.items = this.pagination.reversed ? [...items].reverse().concat(this.items) : this.items.concat(items);
|
||||||
this.more = true;
|
this.more = true;
|
||||||
|
|
|
@ -32,5 +32,4 @@ export async function injectPromo(user: User, timeline: Note[]) {
|
||||||
|
|
||||||
// Inject promo
|
// Inject promo
|
||||||
timeline.splice(3, 0, note);
|
timeline.splice(3, 0, note);
|
||||||
timeline.pop();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue