diff --git a/src/components/card/AttachmentList.vue b/src/components/card/AttachmentList.vue index c6a05c7f8..9a430afb7 100644 --- a/src/components/card/AttachmentList.vue +++ b/src/components/card/AttachmentList.vue @@ -83,11 +83,6 @@ export default { required: false, }, }, - data() { - return { - - } - }, computed: { attachments() { return [...this.$store.getters.attachmentsByCard(this.cardId)].sort((a, b) => b.id - a.id) diff --git a/src/components/card/CardSidebarTabAttachments.vue b/src/components/card/CardSidebarTabAttachments.vue index 09adb140d..3d0e9261d 100644 --- a/src/components/card/CardSidebarTabAttachments.vue +++ b/src/components/card/CardSidebarTabAttachments.vue @@ -114,6 +114,11 @@ export default { return this.card.id }, }, + watch: { + card(newCard) { + this.$store.dispatch('fetchAttachments', newCard.id) + }, + }, created: function() { this.$store.dispatch('fetchAttachments', this.card.id) }, diff --git a/src/store/attachment.js b/src/store/attachment.js index 8376adf95..ad696ba12 100644 --- a/src/store/attachment.js +++ b/src/store/attachment.js @@ -48,11 +48,7 @@ export default { }, createAttachments(state, { cardId, attachments }) { - if (typeof state.attachments[cardId] === 'undefined') { - Vue.set(state.attachments, cardId, attachments) - } else { - state.attachments[cardId].push(attachments) - } + Vue.set(state.attachments, cardId, attachments) }, updateAttachment(state, { cardId, attachment }) {