Browse Source

fix: group by reload

pull/8354/head
mertmit 7 months ago
parent
commit
1a1d81a792
  1. 15
      packages/nc-gui/components/smartsheet/grid/GroupBy.vue
  2. 11
      packages/nc-gui/composables/useViewGroupBy.ts

15
packages/nc-gui/components/smartsheet/grid/GroupBy.vue

@ -108,16 +108,21 @@ onBeforeUnmount(async () => {
reloadViewDataHook?.off(reloadViewDataHandler) reloadViewDataHook?.off(reloadViewDataHandler)
}) })
watch( watch([() => vGroup.value.key], async (n, o) => {
[() => vGroup.value.key],
async (n, o) => {
if (n !== o) { if (n !== o) {
if (!vGroup.value.nested) { if (!vGroup.value.nested) {
await _loadGroupData(vGroup.value, true) await _loadGroupData(vGroup.value, true)
} else if (vGroup.value.nested) {
await props.loadGroups({}, vGroup.value)
} }
} }
}, })
)
onMounted(async () => {
if (vGroup.value.root === true) {
await props.loadGroups({}, vGroup.value)
}
})
if (vGroup.value.root === true) provide(ScrollParentInj, wrapper) if (vGroup.value.root === true) provide(ScrollParentInj, wrapper)

11
packages/nc-gui/composables/useViewGroupBy.ts

@ -421,12 +421,10 @@ const [useProvideViewGroupBy, useViewGroupBy] = useInjectionState(
if (groupBy.value.length > 0) { if (groupBy.value.length > 0) {
rootGroup.value.paginationData = { page: 1, pageSize: groupByGroupLimit.value } rootGroup.value.paginationData = { page: 1, pageSize: groupByGroupLimit.value }
rootGroup.value.column = {} as any rootGroup.value.column = {} as any
await loadGroups()
refreshNested() refreshNested()
nextTick(() => reloadViewDataHook?.trigger()) nextTick(() => reloadViewDataHook?.trigger())
} }
}, },
{ immediate: true },
) )
const findGroupByNestedIn = (nestedIn: GroupNestedIn[], group?: Group, nestLevel = 0): Group => { const findGroupByNestedIn = (nestedIn: GroupNestedIn[], group?: Group, nestLevel = 0): Group => {
@ -543,12 +541,11 @@ const [useProvideViewGroupBy, useViewGroupBy] = useInjectionState(
} }
} }
onMounted(async () => { watch([() => view?.value?.id, () => meta.value?.columns], async ([newViewId]) => {
await loadAllowedLookups() // reload only if view belongs to current table
}) if (newViewId && view.value?.fk_model_id === meta.value?.id) {
watch(meta, async () => {
await loadAllowedLookups() await loadAllowedLookups()
}
}) })
return { return {

Loading…
Cancel
Save