feat: first field now autofocus when editing a row

fix: move the focus to the first editable element

fix: make the Autocomplete options popup on autoFocus

feat: allow saving on table only when changes occurred

fix: compare only the editing row instead of the entire list to decide
if the save method will be called
This commit is contained in:
Liordino Neto 2020-08-19 17:54:29 -03:00 committed by Josh Harvey
parent 1e810daabc
commit 246f736fa8
3 changed files with 20 additions and 4 deletions

View file

@ -57,9 +57,12 @@ const ETable = ({
const index = R.findIndex(R.propEq('id', it.id))(data)
const list = index !== -1 ? R.update(index, it, data) : R.prepend(it, data)
// no response means the save failed
const response = await save({ [name]: list }, it)
if (!response) return
if (!R.equals(data[index], it)) {
// no response means the save failed
const response = await save({ [name]: list }, it)
if (!response) return
}
setAdding(false)
setEditingId(null)
}