Commit 2de4182d authored by Martin Santangelo's avatar Martin Santangelo

(fix) broke pagination after remove too many activities from a unsub channel

1 merge request!474remove the activities from the feed on unsub and reload feed on subscribing
......@@ -347,7 +347,10 @@ export default class FeedsService {
* @param {string} guid
*/
async removeFromOwner(guid: string): Promise<void> {
let count = this.feed.length;
this.feed = this.feed.filter(e => !e.owner_guid || e.owner_guid !== guid);
count -= this.feed.length;
this.offset -= count;
await feedsStorage.save(this);
}
......
......@@ -186,11 +186,15 @@ export default class FeedStore {
@action
removeFromOwner(guid) {
this.entities = this.entities.filter(
e => {
return !e.ownerObj || e.ownerObj.guid !== guid
}
e => !e.ownerObj || e.ownerObj.guid !== guid,
);
this.feedsService.removeFromOwner(guid);
// after the filter we have less than a page of data?
if (this.feedsService.offset < this.feedsService.limit) {
// we load another page to prevent block the pagination
this.loadMore();
}
}
/**
......
Please register or to comment