make sure load more on approve/reject queues doesn't cause a bug

This commit is contained in:
riley
2017-05-02 15:58:57 -06:00
parent b7d3113677
commit e60bcb9caf
@@ -63,13 +63,21 @@ export const loadMore = (fetchMore) => ({limit, cursor, sort, tab, asset_id}) =>
asset_id
},
updateQuery: (oldData, {fetchMoreResult:{comments}}) => {
return {
const updatedData = {
...oldData,
[tab]: [
...oldData[tab],
...comments
]
};
// if we're not in the all tab, put the new comments in there anyway
// this way the acceptComment and rejectComment mutations don't break
if (tab !== 'all') {
updatedData.all = [...updatedData.all, ...comments];
}
return updatedData;
}
});
};