Browse Source

fix(gui): avoid linking if new record

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3569/head
Pranav C 2 years ago committed by Raju Udava
parent
commit
1cb3b05114
  1. 4
      packages/nc-gui/components/smartsheet/expanded-form/Header.vue
  2. 1
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  3. 1
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  4. 2
      packages/nc-gui/composables/useExpandedFormStore.ts

4
packages/nc-gui/components/smartsheet/expanded-form/Header.vue

@ -11,11 +11,13 @@ const { isNew, syncLTARRefs } = useSmartsheetRowStoreOrThrow()
const { isUIAllowed } = useUIPermission()
const reloadTrigger = inject(ReloadViewDataHookInj)!
const save = async () => {
if (isNew.value) {
const data = await _save()
await syncLTARRefs(data)
await loadRow()
reloadTrigger?.trigger()
} else {
await _save()
}

1
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -86,6 +86,7 @@ const reloadTrigger = inject(ReloadViewDataHookInj)!
const reloadHook = createEventHook()
reloadHook.on(() => {
if (isNew.value) return
loadRow()
reloadTrigger?.trigger()
})

1
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -64,6 +64,7 @@ const expandedFormDlg = ref(false)
/** populate initial state for a new row which is parent/child of current record */
const newRowState = computed(() => {
if(isNew.value) return {}
const colOpt = (column?.value as ColumnType)?.colOptions as LinkToAnotherRecordType
const colInRelatedTable: ColumnType | undefined = relatedTableMeta?.value?.columns?.find((col) => {
if (col.uidt !== UITypes.LinkToAnotherRecord) return false

2
packages/nc-gui/composables/useExpandedFormStore.ts

@ -30,7 +30,6 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
const { project } = useProject()
const rowStore = useProvideSmartsheetRowStore(meta, row)
const { sharedView } = useSharedView() as Record<string, any>
const reloadTrigger = inject(ReloadViewDataHookInj)!
// todo
// const activeView = inject(ActiveViewInj)
@ -170,7 +169,6 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
message.success(`${primaryValue.value || 'Row'} updated successfully.`)
changedColumns.value = new Set()
reloadTrigger?.trigger()
} catch (e: any) {
message.error(`${t('msg.error.rowUpdateFailed')}: ${await extractSdkResponseErrorMsg(e)}`)
}

Loading…
Cancel
Save