fix: multiple after-update webhooks being triggered

Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
mertmit
2022-03-29 20:23:55 +03:00
parent 47a5131c15
commit f16cd2e909
5 changed files with 21 additions and 18 deletions

View File

@@ -1079,7 +1079,7 @@ export default {
// onCellValueChange(col, row, column) {
// this.onCellValueChangeFn(col, row, column)
// },
async onCellValueChange(col, row, column) {
async onCellValueChange(col, row, column, saved = false) {
if (!this.data[row]) {
return
}
@@ -1096,7 +1096,7 @@ export default {
return
}
// return if there is no change
if (oldRow[column._cn] === rowObj[column._cn]) {
if (oldRow[column._cn] === rowObj[column._cn] && !saved) {
return
}
const id = this.meta.columns.filter(c => c.pk).map(c => rowObj[c._cn]).join('___')
@@ -1109,7 +1109,7 @@ export default {
// eslint-disable-next-line promise/param-names
const newData = await this.api.update(id, {
[column._cn]: rowObj[column._cn]
}, { [column._cn]: oldRow[column._cn] })
}, { [column._cn]: oldRow[column._cn] }, saved)
this.$set(this.data[row], 'row', { ...rowObj, ...newData })
this.$set(oldRow, column._cn, rowObj[column._cn])
@@ -1178,7 +1178,7 @@ export default {
return
}
this.$set(this.data[index].row, col._cn, null)
await this.onCellValueChange(colIndex, index, col)
await this.onCellValueChange(colIndex, index, col, true)
},
async insertNewRow(atEnd = false, expand = false, presetValues = {}) {
const isKanban = this.selectedView && this.selectedView.show_as === 'kanban'