Browse Source

refactor(gui-v2): use utility function to extract id

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3339/head
Pranav C 2 years ago
parent
commit
3bc93b953a
  1. 2
      packages/nc-gui-v2/composables/useExpandedFormStore.ts
  2. 7
      packages/nc-gui-v2/composables/useViewData.ts

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

@ -148,7 +148,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
prev_value: getHTMLEncodedText(row.value.oldRow[key]),
})
.then(async () => {
/** load latest comments/audit if right drawer is open*/
/** load latest comments/audit if right drawer is open */
if (commentsDrawer.value) {
await loadCommentsAndLogs()
}

7
packages/nc-gui-v2/composables/useViewData.ts

@ -167,10 +167,7 @@ export function useViewData(
const updateRowProperty = async (toUpdate: Row, property: string) => {
try {
const id = meta?.value?.columns
?.filter((c) => c.pk)
.map((c) => toUpdate.row[c.title as string])
.join('___') as string
const id = extractPkFromRow(toUpdate.row, meta.value.columns as ColumnType[])
const updatedRowData = await $api.dbViewRow.update(
NOCO,
@ -195,7 +192,7 @@ export function useViewData(
value: getHTMLEncodedText(toUpdate.row[property]),
prev_value: getHTMLEncodedText(toUpdate.oldRow[property]),
})
.catch(() => {})
.then(() => {})
/** update row data(to sync formula and other related columns) */
Object.assign(toUpdate.row, updatedRowData)

Loading…
Cancel
Save