Browse Source

refactor(nc-gui): use ReloadViewMetaHookInj instead of ReloadKanbanMetaHookInj

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
cb2f76bc77
  1. 6
      packages/nc-gui/components/smartsheet-column/EditOrAdd.vue
  2. 4
      packages/nc-gui/components/smartsheet/Kanban.vue
  3. 3
      packages/nc-gui/components/tabs/Smartsheet.vue
  4. 1
      packages/nc-gui/context/index.ts

6
packages/nc-gui/components/smartsheet-column/EditOrAdd.vue

@ -5,8 +5,8 @@ import {
IsFormInj,
IsKanbanInj,
MetaInj,
ReloadKanbanMetaHookInj,
ReloadViewDataHookInj,
ReloadViewMetaHookInj,
computed,
inject,
uiTypes,
@ -35,7 +35,7 @@ const isForm = inject(IsFormInj, ref(false))
const isKanban = inject(IsKanbanInj, ref(false))
const reloadKanbanMetaTrigger = inject(ReloadKanbanMetaHookInj)
const reloadMetaTrigger = inject(ReloadViewMetaHookInj)
const reloadDataTrigger = inject(ReloadViewDataHookInj)
@ -64,7 +64,7 @@ const reloadMetaAndData = async () => {
await getMeta(meta.value?.id as string, true)
if (isKanban.value) {
reloadKanbanMetaTrigger?.trigger()
reloadMetaTrigger?.trigger()
} else {
reloadDataTrigger?.trigger()
}

4
packages/nc-gui/components/smartsheet/Kanban.vue

@ -26,7 +26,7 @@ const view = inject(ActiveViewInj, ref())
const reloadViewDataHook = inject(ReloadViewDataHookInj)
const reloadKanbanMetaHook = inject(ReloadKanbanMetaHookInj)
const reloadViewMetaHook = inject(ReloadViewMetaHookInj)
const openNewRecordFormHook = inject(OpenNewRecordFormHookInj, createEventHook())
@ -85,7 +85,7 @@ reloadViewDataHook?.on(async () => {
await loadKanbanData()
})
reloadKanbanMetaHook?.on(async () => {
reloadViewMetaHook?.on(async () => {
await loadKanbanMeta()
})

3
packages/nc-gui/components/tabs/Smartsheet.vue

@ -8,7 +8,6 @@ import {
IsLockedInj,
MetaInj,
OpenNewRecordFormHookInj,
ReloadKanbanMetaHookInj,
ReloadViewDataHookInj,
ReloadViewMetaHookInj,
computed,
@ -39,7 +38,6 @@ const meta = computed<TableType>(() => metas.value?.[activeTab?.id as string])
const reloadEventHook = createEventHook<void>()
const reloadViewMetaEventHook = createEventHook<void>()
const openNewRecordFormHook = createEventHook<void>()
const reloadKanbanMetaHook = createEventHook<void>()
const { isGallery, isGrid, isForm, isKanban, isLocked } = useProvideSmartsheetStore(activeView, meta)
@ -51,7 +49,6 @@ provide(MetaInj, meta)
provide(ActiveViewInj, activeView)
provide(IsLockedInj, isLocked)
provide(ReloadViewDataHookInj, reloadEventHook)
provide(ReloadKanbanMetaHookInj, reloadKanbanMetaHook)
provide(ReloadViewMetaHookInj, reloadViewMetaEventHook)
provide(OpenNewRecordFormHookInj, openNewRecordFormHook)
provide(FieldsInj, fields)

1
packages/nc-gui/context/index.ts

@ -22,7 +22,6 @@ export const IsLockedInj: InjectionKey<Ref<boolean>> = Symbol('is-locked-injecti
export const CellValueInj: InjectionKey<Ref<any>> = Symbol('cell-value-injection')
export const ActiveViewInj: InjectionKey<Ref<ViewType>> = Symbol('active-view-injection')
export const ReadonlyInj: InjectionKey<boolean> = Symbol('readonly-injection')
export const ReloadKanbanMetaHookInj: InjectionKey<EventHook<void>> = Symbol('reload-kanban-meta-injection')
/** when bool is passed, it indicates if a loading spinner should be visible while reloading */
export const ReloadViewDataHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-view-data-injection')
export const ReloadViewMetaHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-view-meta-injection')

Loading…
Cancel
Save