diff --git a/webapp/src/store/comments.ts b/webapp/src/store/comments.ts index 2b6dbc29f..325d804ab 100644 --- a/webapp/src/store/comments.ts +++ b/webapp/src/store/comments.ts @@ -58,9 +58,9 @@ const commentsSlice = createSlice({ state.comments[block.id] = block as CommentBlock state.commentsByCard[block.parentId] = state.commentsByCard[block.parentId] || [] state.commentsByCard[block.parentId].push(block as CommentBlock) - state.commentsByCard[block.parentId].sort((a, b) => a.createAt - b.createAt) } } + Object.values(state.commentsByCard).forEach((comment) => comment.sort((a, b) => a.createAt - b.createAt)) }) builder.addCase(loadBoardData.fulfilled, (state, action) => { state.comments = {} @@ -70,9 +70,9 @@ const commentsSlice = createSlice({ state.comments[block.id] = block as CommentBlock state.commentsByCard[block.parentId] = state.commentsByCard[block.parentId] || [] state.commentsByCard[block.parentId].push(block as CommentBlock) - state.commentsByCard[block.parentId].sort((a, b) => a.createAt - b.createAt) } } + Object.values(state.commentsByCard).forEach((comment) => comment.sort((a, b) => a.createAt - b.createAt)) }) }, })