diff --git a/src/components/card/TagSelector.vue b/src/components/card/TagSelector.vue index c8953089c..2f3034d84 100644 --- a/src/components/card/TagSelector.vue +++ b/src/components/card/TagSelector.vue @@ -75,7 +75,10 @@ export default { }, methods: { onSelect(options) { - const addedLabel = options.filter(option => !this.card.labels.includes(option)) + const addedLabel = options.filter(option => !this.card.labels.includes(option) && option.id && option.color) + if (addedLabel.length == 0) { + return + } this.$emit('select', addedLabel[0]) }, onRemove(removedLabel) { diff --git a/src/store/main.js b/src/store/main.js index 1225cd062..b9620d87f 100644 --- a/src/store/main.js +++ b/src/store/main.js @@ -492,6 +492,7 @@ export default function storeFactory() { async addLabelToCurrentBoardAndCard({ dispatch, commit }, { newLabel, card }) { newLabel.boardId = this.state.currentBoard.id const label = await apiClient.createLabel(newLabel) + card.labels.push(label) commit('addLabelToCurrentBoard', label) dispatch('addLabel', { card,