Browse Source

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

pull/9827/head
Pranav C 2 weeks ago
parent
commit
2146f93761
  1. 6
      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

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

@ -339,13 +339,15 @@ async function submitForm() {
} }
} }
await insertRow({ const res = await insertRow({
row: { ...formState.value, ...state.value }, row: { ...formState.value, ...state.value },
oldRow: {}, oldRow: {},
rowMeta: { new: true }, rowMeta: { new: true },
}) })
submitted.value = true if (res) {
submitted.value = true
}
} }
async function clearForm() { async function clearForm() {

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

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

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

Loading…
Cancel
Save