mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-04 02:47:58 +00:00
fix(gui): wait until inserting record to avoid duplicate row insertion
Signed-off-by: Pranav C <pranavxc@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
message,
|
||||
populateInsertObject,
|
||||
ref,
|
||||
until,
|
||||
useApi,
|
||||
useGlobal,
|
||||
useI18n,
|
||||
@@ -224,8 +225,8 @@ export function useViewData(
|
||||
insertObj,
|
||||
)
|
||||
|
||||
formattedData.value?.splice(rowIndex ?? 0, 1, {
|
||||
row: insertedData,
|
||||
Object.assign(formattedData.value[rowIndex], {
|
||||
row: { ...insertedData, ...row },
|
||||
rowMeta: { ...row.rowMeta, new: undefined },
|
||||
oldRow: { ...insertedData },
|
||||
})
|
||||
@@ -287,6 +288,9 @@ export function useViewData(
|
||||
ltarState?: Record<string, any>,
|
||||
args: { metaValue?: TableType; viewMetaValue?: ViewType } = {},
|
||||
) {
|
||||
// if new row and save is in progress then wait until the save is complete
|
||||
await until(() => !(row.rowMeta.new && row.rowMeta.saving)).toMatch((v) => v)
|
||||
|
||||
if (row.rowMeta.new) {
|
||||
return await insertRow(row.row, formattedData.value.indexOf(row), ltarState, args)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user