Check existance of featuredComments in query

This commit is contained in:
Chi Vinh Le
2017-08-15 16:43:44 +07:00
parent 2284692931
commit db37a0b38e
@@ -26,6 +26,9 @@ export default {
IgnoreUser: ({variables}) => ({
updateQueries: {
CoralEmbedStream_Embed: (previous) => {
if (!previous.asset.featuredComments) {
return previous;
}
const ignoredUserId = variables.id;
const newNodes = previous.asset.featuredComments.nodes.filter((n) => n.user.id !== ignoredUserId);
const removedCount = previous.asset.featuredComments.nodes.length - newNodes.length;