Browse Source

fix(gui): on updating/saving in nested level expanded-form reload all ancestor level data

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

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

@ -79,6 +79,18 @@ const onClose = () => {
if (row.value?.rowMeta?.new) emits('cancel')
isExpanded.value = false
}
// override reload trigger and use it to reload grid and the form itself
const reloadTrigger = inject(ReloadViewDataHookInj)!
const reloadHook = createEventHook()
reloadHook.on(() => {
loadRow()
reloadTrigger?.trigger()
})
provide(ReloadViewDataHookInj, reloadHook)
</script>
<script lang="ts">

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

@ -30,6 +30,7 @@ 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)
@ -169,6 +170,7 @@ 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