Browse Source

fix(gui-v2): reload data after column add/update

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3005/head
Pranav C 2 years ago
parent
commit
cbd1f17185
  1. 18
      packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

18
packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { UITypes, isVirtualCol } from 'nocodb-sdk'
import { computed, inject, useColumnCreateStoreOrThrow, useMetas, watchEffect } from '#imports'
import { MetaInj } from '~/context'
import { MetaInj, ReloadViewDataHookInj } from '~/context'
import { uiTypes } from '~/utils/columnUtils'
import MdiPlusIcon from '~icons/mdi/plus-circle-outline'
import MdiMinusIcon from '~icons/mdi/minus-circle-outline'
@ -13,11 +13,9 @@ interface Props {
const { editColumnDropdown } = defineProps<Props>()
const emit = defineEmits(['cancel'])
const meta = inject(MetaInj)
const reloadDataTrigger = inject(ReloadViewDataHookInj)
const advancedOptions = ref(false)
const { getMeta } = useMetas()
const formulaOptionsRef = ref()
@ -50,9 +48,10 @@ const uiTypesOptions = computed<typeof uiTypes>(() => {
]
})
const reloadMeta = () => {
const reloadMetaAndData = () => {
emit('cancel')
getMeta(meta?.value.id as string, true)
reloadDataTrigger?.trigger()
}
function onCancel() {
@ -144,7 +143,7 @@ watch(
v-model:checked="formState.meta.validate"
class="ml-1 mb-1"
>
<span class="text-xs text-gray-600">
<span class="text-[10px] text-gray-600">
{{ `Accept only valid ${formState.uidt}` }}
</span>
</a-checkbox>
@ -156,7 +155,12 @@ watch(
<!-- Cancel -->
{{ $t('general.cancel') }}
</a-button>
<a-button html-type="submit" type="primary" size="small" @click="addOrUpdate(reloadMeta), (advancedOptions = false)">
<a-button
html-type="submit"
type="primary"
size="small"
@click="addOrUpdate(reloadMetaAndData), (advancedOptions = false)"
>
<!-- Save -->
{{ $t('general.save') }}
</a-button>

Loading…
Cancel
Save