Skip to content

Commit 9db9ea8

Browse files
theohollgrnd-alt
authored andcommitted
Remove mapping of comment store actions to computed methods
Signed-off-by: Theo <36564257+theoholl@users.noreply.github.com>
1 parent df36415 commit 9db9ea8

2 files changed

Lines changed: 7 additions & 16 deletions

File tree

src/components/card/CardSidebarTabComments.vue

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
</span>
1212
</div>
1313

14-
<CommentItem v-if="replyTo"
15-
:comment="replyTo"
14+
<CommentItem v-if="commentStore.replyTo"
15+
:comment="commentStore.replyTo"
1616
:reply="true"
1717
:preview="true"
1818
@cancel="cancelReply" />
1919
<CommentForm v-model="newComment" @submit="createComment" />
2020

21-
<ul v-if="getCommentsForCard(card.id).length > 0" id="commentsFeed">
22-
<CommentItem v-for="comment in getCommentsForCard(card.id)"
21+
<ul v-if="commentStore.getCommentsForCard(card.id).length > 0" id="commentsFeed">
22+
<CommentItem v-for="comment in commentStore.getCommentsForCard(card.id)"
2323
:key="comment.id"
2424
:comment="comment"
2525
@doReload="loadComments" />
@@ -81,15 +81,6 @@ export default {
8181
...mapState({
8282
currentBoard: state => state.currentBoard,
8383
}),
84-
replyTo() {
85-
return this.commentStore.replyTo
86-
},
87-
getCommentsForCard() {
88-
return this.commentStore.getCommentsForCard
89-
},
90-
hasMoreComments() {
91-
return this.commentStore.hasMoreComments
92-
},
9384
members() {
9485
return this.currentBoard.users
9586
},
@@ -107,7 +98,7 @@ export default {
10798
this.error = null
10899
try {
109100
await this.loadMore()
110-
if (this.hasMoreComments(this.card.id)) {
101+
if (this.commentStore.hasMoreComments(this.card.id)) {
111102
$state.loaded()
112103
} else {
113104
$state.complete()

src/stores/comment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export const useCommentStore = defineStore('comment', {
4848
},
4949
async updateComment({ cardId, comment }) {
5050
const updatedComment = await apiClient.updateComment({ cardId, id: comment.id, comment: comment.message })
51-
const existingIndex = this.comments[cardId].comments.findIndex(c => c.id === comment.id)
51+
const existingIndex = this.comments[cardId].comments.findIndex(c => c.id === updatedComment.id)
5252
if (existingIndex !== -1) {
53-
Object.assign(this.comments[cardId].comments[existingIndex], comment)
53+
Object.assign(this.comments[cardId].comments[existingIndex], updatedComment)
5454
}
5555
},
5656
async deleteComment(comment) {

0 commit comments

Comments
 (0)