Skip to content

Commit b240fa8

Browse files
authored
Merge pull request #2059 from nextcloud/bugfix/noid/attachment-fetch
Fix fetching attachments on card change
2 parents b420949 + 8f77aa0 commit b240fa8

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/components/card/AttachmentList.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ export default {
8383
required: false,
8484
},
8585
},
86-
data() {
87-
return {
88-
89-
}
90-
},
9186
computed: {
9287
attachments() {
9388
return [...this.$store.getters.attachmentsByCard(this.cardId)].sort((a, b) => b.id - a.id)

src/components/card/CardSidebarTabAttachments.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ export default {
114114
return this.card.id
115115
},
116116
},
117+
watch: {
118+
card(newCard) {
119+
this.$store.dispatch('fetchAttachments', newCard.id)
120+
},
121+
},
117122
created: function() {
118123
this.$store.dispatch('fetchAttachments', this.card.id)
119124
},

src/store/attachment.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ export default {
4848
},
4949

5050
createAttachments(state, { cardId, attachments }) {
51-
if (typeof state.attachments[cardId] === 'undefined') {
52-
Vue.set(state.attachments, cardId, attachments)
53-
} else {
54-
state.attachments[cardId].push(attachments)
55-
}
51+
Vue.set(state.attachments, cardId, attachments)
5652
},
5753

5854
updateAttachment(state, { cardId, attachment }) {

0 commit comments

Comments
 (0)