1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-11-24 08:22:29 +02:00

Optimised Sorting of comments inside cards (#4207)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Rajat Dabade 2022-11-28 14:39:55 +05:30 committed by GitHub
parent 0f5f4b0590
commit 09e0f045a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,9 +58,9 @@ const commentsSlice = createSlice({
state.comments[block.id] = block as CommentBlock state.comments[block.id] = block as CommentBlock
state.commentsByCard[block.parentId] = state.commentsByCard[block.parentId] || [] state.commentsByCard[block.parentId] = state.commentsByCard[block.parentId] || []
state.commentsByCard[block.parentId].push(block as CommentBlock) 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) => { builder.addCase(loadBoardData.fulfilled, (state, action) => {
state.comments = {} state.comments = {}
@ -70,9 +70,9 @@ const commentsSlice = createSlice({
state.comments[block.id] = block as CommentBlock state.comments[block.id] = block as CommentBlock
state.commentsByCard[block.parentId] = state.commentsByCard[block.parentId] || [] state.commentsByCard[block.parentId] = state.commentsByCard[block.parentId] || []
state.commentsByCard[block.parentId].push(block as CommentBlock) 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))
}) })
}, },
}) })