Browse Source

Merge pull request #4221 from nocodb/fix/4220-clearing-cell

Fix: Grid cell - avoid overwriting LTAR and Lookup cell on cell update
pull/4223/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
11ecf39371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 7
      packages/nc-gui/composables/useViewData.ts

1
packages/nc-gui/components/smartsheet/Gallery.vue

@ -21,7 +21,6 @@ import {
onMounted, onMounted,
provide, provide,
ref, ref,
useUIPermission,
useViewData, useViewData,
} from '#imports' } from '#imports'
import type { Row as RowType } from '~/lib' import type { Row as RowType } from '~/lib'

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

@ -1,4 +1,4 @@
import { ViewTypes, isVirtualCol } from 'nocodb-sdk' import { UITypes, ViewTypes } from 'nocodb-sdk'
import type { Api, ColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk' import type { Api, ColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue' import type { ComputedRef, Ref } from 'vue'
import { import {
@ -273,12 +273,13 @@ export function useViewData(
}) })
/** update row data(to sync formula and other related columns) /** update row data(to sync formula and other related columns)
* update only virtual columns data to avoid overwriting any changes made by user * update only formula, rollup and auto updated datetime columns data to avoid overwriting any changes made by user
*/ */
Object.assign( Object.assign(
toUpdate.row, toUpdate.row,
metaValue!.columns!.reduce<Record<string, any>>((acc: Record<string, any>, col: ColumnType) => { metaValue!.columns!.reduce<Record<string, any>>((acc: Record<string, any>, col: ColumnType) => {
if (isVirtualCol(col)) acc[col.title!] = updatedRowData[col.title!] if (col.uidt === UITypes.Formula || col.uidt === UITypes.Rollup || col.au || col.cdf?.includes(' on update '))
acc[col.title!] = updatedRowData[col.title!]
return acc return acc
}, {} as Record<string, any>), }, {} as Record<string, any>),
) )

Loading…
Cancel
Save