Skip to content

Commit 9ea2f0d

Browse files
committed
fix(gantt): wrap update start and due date in one request
Signed-off-by: grnd-alt <git@belakkaf.net>
1 parent 02cc1a3 commit 9ea2f0d

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/components/board/GanttView.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,11 @@ export default {
347347
this.fitColumnsToWidth()
348348
},
349349
async updateTaskDate(task, start, end) {
350-
await this.$store.dispatch('updateCardDue', { ...task._card, duedate: new Date(end).toISOString() })
351-
await this.$store.dispatch('updateCardStartDate', { ...task._card, startdate: new Date(start).toISOString() })
350+
await this.$store.dispatch('updateCardDates', {
351+
...task._card,
352+
startdate: new Date(start).toISOString(),
353+
duedate: new Date(end).toISOString(),
354+
})
352355
},
353356
_patchBarDuration() {
354357
const bars = this.ganttInstance?.bars

src/store/card.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,19 @@ export default function cardModuleFactory() {
388388
const updatedCard = await apiClient.updateCard(card, stack.boardId)
389389
commit('updateCardProperty', { property: 'startdate', card: updatedCard })
390390
},
391+
async updateCardDates({ commit, getters }, card) {
392+
const stack = getters.stackById(card.stackId)
393+
const updatedCard = await apiClient.updateCard(card, stack.boardId)
394+
commit('updateCardProperty', { property: 'duedate', card: updatedCard })
395+
commit('updateCardProperty', { property: 'startdate', card: updatedCard })
396+
},
391397
async updateCardColor({ commit, getters }, card) {
392398
const stack = getters.stackById(card.stackId)
393399
const updatedCard = await apiClient.updateCard(card, stack.boardId)
394400
commit('updateCardProperty', { property: 'color', card: updatedCard })
395401
},
396402

403+
397404
addCardData({ commit }, cardData) {
398405
const card = { ...cardData }
399406
commit('addStack', card.relatedStack)

0 commit comments

Comments
 (0)