Fixes: Homepage pagination

This commit is contained in:
Tom Moor 2018-08-11 14:02:37 -07:00
parent 63f6d61ac0
commit 6cd7d5ca5b
1 changed files with 5 additions and 5 deletions

View File

@ -102,7 +102,7 @@ class DocumentsStore extends BaseStore {
fetchPage = async (
request: string = 'list',
options: ?PaginationParams
): Promise<*> => {
): Promise<?(Document[])> => {
this.isFetching = true;
try {
@ -128,8 +128,8 @@ class DocumentsStore extends BaseStore {
const data = await this.fetchPage('list', options);
runInAction('DocumentsStore#fetchRecentlyEdited', () => {
this.recentlyEditedIds = uniq(
map(data, 'id').concat(this.recentlyEditedIds)
this.recentlyEditedIds.replace(
uniq(this.recentlyEditedIds.concat(map(data, 'id')))
);
});
return data;
@ -140,8 +140,8 @@ class DocumentsStore extends BaseStore {
const data = await this.fetchPage('viewed', options);
runInAction('DocumentsStore#fetchRecentlyViewed', () => {
this.recentlyViewedIds = uniq(
map(data, 'id').concat(this.recentlyViewedIds)
this.recentlyViewedIds.replace(
uniq(this.recentlyViewedIds.concat(map(data, 'id')))
);
});
return data;