Browse Source

fix: add missing await and treat form submit success only if it returns valid response

pull/9827/head
Pranav C 1 week ago
parent
commit
2146f93761
  1. 4
      packages/nc-gui/components/smartsheet/Form.vue
  2. 2
      packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue
  3. 1
      packages/nc-gui/utils/dataUtils.ts

4
packages/nc-gui/components/smartsheet/Form.vue

@ -339,14 +339,16 @@ async function submitForm() {
}
}
await insertRow({
const res = await insertRow({
row: { ...formState.value, ...state.value },
oldRow: {},
rowMeta: { new: true },
})
if (res) {
submitted.value = true
}
}
async function clearForm() {
if (!isUIAllowed('dataInsert')) return

2
packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue

@ -66,7 +66,7 @@ const relation = computed(() => {
const linkRow = async (row: Record<string, any>, id: number) => {
if (isNew.value) {
addLTARRef(row, injectedColumn?.value as ColumnType)
await addLTARRef(row, injectedColumn?.value as ColumnType)
if (relation.value === 'oo' || relation.value === 'bt') {
isChildrenExcludedListLinked.value.forEach((isLinked, idx) => {
if (isLinked) {

1
packages/nc-gui/utils/dataUtils.ts

@ -81,6 +81,7 @@ export async function populateInsertObject({
throwError?: boolean
undo?: boolean
}) {
debugger
const missingRequiredColumns = new Set()
const insertObj = await meta.columns?.reduce(async (_o: Promise<any>, col) => {
const o = await _o

Loading…
Cancel
Save