Rollback state changes when row saving fails

This commit is contained in:
Andrew Kingston 2023-03-30 08:52:43 +01:00
parent aaa0f1a7a0
commit 7ba064dd31
1 changed files with 6 additions and 0 deletions

View File

@ -203,6 +203,12 @@ export const createRowsStore = context => {
await API.saveRow(newRow)
} catch (error) {
notifications.error(`Error saving row: ${error?.message}`)
// Revert change
rows.update(state => {
state[index] = row
return state
})
}
}