Browse Source

refactor(gui): update data directly

instead of reloading entire data modify row object directly

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4046/head
Pranav C 2 years ago
parent
commit
d20af97a83
  1. 6
      packages/nc-gui/components/smartsheet/Row.vue
  2. 2
      packages/nc-gui/composables/useSmartsheetRowStore.ts

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

@ -1,5 +1,4 @@
<script lang="ts" setup>
import type { ColumnType } from 'nocodb-sdk'
import type { Row } from '~/lib'
import {
ReloadRowDataHookInj,
@ -47,10 +46,7 @@ provide(ReloadRowDataHookInj, reloadHook)
defineExpose({
syncLTARRefs,
async clearLTARCell(column: ColumnType) {
await clearLTARCell(column)
reloadViewDataTrigger?.trigger(true)
},
clearLTARCell,
})
</script>

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

@ -140,6 +140,7 @@ const [useProvideSmartsheetRowStore, useSmartsheetRowStore] = useInjectionState(
column.title as string,
extractPkFromRow(currentRow.value.row[column.title!], relatedTableMeta?.columns as ColumnType[]),
)
currentRow.value.row[column.title!] = null
} else {
for (const link of (currentRow.value.row[column.title!] as Record<string, any>[]) || []) {
await $api.dbTableRow.nestedRemove(
@ -151,6 +152,7 @@ const [useProvideSmartsheetRowStore, useSmartsheetRowStore] = useInjectionState(
column.title as string,
extractPkFromRow(link, relatedTableMeta?.columns as ColumnType[]),
)
currentRow.value.row[column.title!] = []
}
}
}

Loading…
Cancel
Save