Browse Source

Fix: aggregation filter sync (#9302)

* fix: sync issue

* fix: sync breaking
nc-fix/missing-is-ui-allowed-def
Anbarasu 3 months ago committed by GitHub
parent
commit
42ac2fde0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      packages/nc-gui/composables/useViewAggregate.ts
  2. 4
      packages/nc-gui/composables/useViewGroupBy.ts

14
packages/nc-gui/composables/useViewAggregate.ts

@ -25,18 +25,18 @@ const [useProvideViewAggregate, useViewAggregate] = useInjectionState(
const { nestedFilters } = useSmartsheetStoreOrThrow()
const { isUIAllowed } = useRoles()
const { fetchAggregatedData } = useSharedView()
const aggregations = ref({}) as Ref<Record<string, any>>
const { isUIAllowed } = useRoles()
const reloadAggregate = inject(ReloadAggregateHookInj)
const visibleFieldsComputed = computed(() => {
const fie = fields.value.map((field, index) => ({ field, index })).filter((f) => f.index !== 0)
const field = fields.value.map((field, index) => ({ field, index })).filter((f) => f.index !== 0)
return fie.map((f) => {
return field.map((f) => {
const gridField = gridViewCols.value[f.field.id!]
if (!gridField) {
@ -44,7 +44,7 @@ const [useProvideViewAggregate, useViewAggregate] = useInjectionState(
}
return {
value: aggregations.value[f.field.title] ?? null,
value: aggregations.value[f.field.title!] ?? null,
field: gridField,
column: f.field,
index: f.index,
@ -82,8 +82,8 @@ const [useProvideViewAggregate, useViewAggregate] = useInjectionState(
}>,
) => {
// Wait for meta to be defined https://vueuse.org/shared/until/
await until(meta)
.toBeTruthy((c) => !!c, {
await until(() => !!meta.value)
.toBeTruthy({
timeout: 10000,
})
.then(async () => {

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

@ -395,7 +395,7 @@ const [useProvideViewGroupBy, useViewGroupBy] = useInjectionState(
const aggregation = Object.values(gridViewCols.value)
.map((f) => ({
field: f.fk_column_id,
field: f.fk_column_id!,
type: f.aggregation ?? CommonAggregations.None,
}))
.filter((f) => f.type !== CommonAggregations.None)
@ -630,7 +630,7 @@ const [useProvideViewGroupBy, useViewGroupBy] = useInjectionState(
let filteredFields = fields
if (!fields) {
filteredFields = Object.values(gridViewCols.value).map((f) => ({
field: f.fk_column_id,
field: f.fk_column_id!,
type: f.aggregation ?? CommonAggregations.None,
}))
}

Loading…
Cancel
Save