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)
})
watch(
[() => vGroup.value.key],
async (n, o) => {
watch([() => vGroup.value.key], async (n, o) => {
if (n !== o) {
if (!vGroup.value.nested) {
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)

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

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

Loading…
Cancel
Save