Rollback state changes when row saving fails
This commit is contained in:
parent
aaa0f1a7a0
commit
7ba064dd31
|
@ -203,6 +203,12 @@ export const createRowsStore = context => {
|
||||||
await API.saveRow(newRow)
|
await API.saveRow(newRow)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error(`Error saving row: ${error?.message}`)
|
notifications.error(`Error saving row: ${error?.message}`)
|
||||||
|
|
||||||
|
// Revert change
|
||||||
|
rows.update(state => {
|
||||||
|
state[index] = row
|
||||||
|
return state
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue