Fix row types

This commit is contained in:
Adria Navarro 2024-12-27 17:47:11 +01:00
parent 2526997b47
commit 8009ee7ec9
2 changed files with 17 additions and 4 deletions

View File

@ -31,7 +31,8 @@ export const createActions = (context: StoreContext): TableActions => {
...row,
tableId: get(datasource)?.tableId,
}
return await API.saveRow(row, SuppressErrors)
const newRow = await API.saveRow(row, SuppressErrors)
return { ...newRow, _id: newRow._id! }
}
const deleteRows = async (rows: Row[]) => {
@ -52,7 +53,12 @@ export const createActions = (context: StoreContext): TableActions => {
},
paginate: false,
})
return res?.rows?.[0]
const row = res?.rows?.[0]
if (!row) {
return
}
return { ...row, _id: row._id! }
}
const canUseColumn = (name: string) => {

View File

@ -34,8 +34,10 @@ export const createActions = (context: StoreContext): ViewActions => {
tableId: $datasource?.tableId,
_viewId: $datasource?.id,
}
const newRow = await API.saveRow(row, SuppressErrors)
return {
...(await API.saveRow(row, SuppressErrors)),
...newRow,
_id: newRow._id!,
_viewId: row._viewId,
}
}
@ -54,7 +56,12 @@ export const createActions = (context: StoreContext): ViewActions => {
},
paginate: false,
})
return res?.rows?.[0]
const row = res?.rows?.[0]
if (!row) {
return
}
return { ...row, _id: row._id! }
}
const isDatasourceValid = (datasource: UIDatasource) => {