mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
make sure load more on approve/reject queues doesn't cause a bug
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user