1
0
Fork 0
mirror of synced 2024-09-10 06:26:02 +12:00

Fix normal row changes not working

This commit is contained in:
Andrew Kingston 2024-06-21 20:48:55 +01:00
parent 9657781df6
commit 6633cc3cbc
No known key found for this signature in database

View file

@ -470,9 +470,10 @@ export const createActions = context => {
}))
// Update row
const stashedChanges = get(rowChangeCache)[rowId]
const newRow = {
...cleanRow(row),
...get(rowChangeCache)[rowId],
...stashedChanges,
...changes,
}
savedRow = await datasource.actions.updateRow(newRow)
@ -493,8 +494,8 @@ export const createActions = context => {
// Wipe row change cache for any values which have been saved
const liveChanges = get(rowChangeCache)[rowId]
rowChangeCache.update(state => {
Object.keys(changes || {}).forEach(key => {
if (changes[key] === liveChanges?.[key]) {
Object.keys(stashedChanges || {}).forEach(key => {
if (stashedChanges[key] === liveChanges?.[key]) {
delete state[rowId][key]
}
})
@ -519,7 +520,7 @@ export const createActions = context => {
const updateValue = async ({ rowId, column, value, apply = true }) => {
const success = stashRowChanges(rowId, { [column]: value })
if (success && apply) {
await applyRowChanges(rowId)
await applyRowChanges({ rowId })
}
}
@ -715,7 +716,7 @@ export const initialise = context => {
const hasErrors = validation.actions.rowHasErrors(rowId)
const isSavingChanges = get(inProgressChanges)[rowId]
if (rowId && !hasErrors && hasChanges && !isSavingChanges) {
await rows.actions.applyRowChanges(rowId)
await rows.actions.applyRowChanges({ rowId })
}
})
}