diff --git a/apps/comments-ui/src/actions.js b/apps/comments-ui/src/actions.js index fcfc191d80..4ec522405b 100644 --- a/apps/comments-ui/src/actions.js +++ b/apps/comments-ui/src/actions.js @@ -61,13 +61,29 @@ async function hideComment({state, adminApi, data: comment}) { return { comments: state.comments.map((c) => { + const replies = c.replies.map((r) => { + if (r.id === comment.id) { + return { + ...r, + status: 'hidden' + }; + } + + return r; + }); + if (c.id === comment.id) { return { ...c, - status: 'hidden' + status: 'hidden', + replies }; } - return c; + + return { + ...c, + replies + }; }) }; }