Browse Source

fix: lock logical op for filter group as well

pull/8479/head
Pranav C 6 months ago
parent
commit
f8851c7b52
  1. 16
      packages/nc-gui/composables/useViewFilters.ts

16
packages/nc-gui/composables/useViewFilters.ts

@ -192,6 +192,16 @@ export function useViewFilters(
} }
} }
const placeholderGroupFilter = (): Filter => {
const logicalOps = new Set(filters.value.slice(1).map((filter) => filter.logical_op))
return {
is_group: true,
status: 'create',
logical_op: logicalOps.size === 1 ? logicalOps.values().next().value : 'and',
}
}
const loadAllChildFilters = async (filters: Filter[]) => { const loadAllChildFilters = async (filters: Filter[]) => {
// Array to store promises of child filter loading // Array to store promises of child filter loading
const promises = [] const promises = []
@ -464,11 +474,7 @@ export function useViewFilters(
const addFilterGroup = async () => { const addFilterGroup = async () => {
const child = placeholderFilter() const child = placeholderFilter()
const placeHolderGroupFilter: Filter = { const placeHolderGroupFilter: Filter = placeholderGroupFilter()
is_group: true,
status: 'create',
logical_op: 'and',
}
if (nestedMode.value) placeHolderGroupFilter.children = [child] if (nestedMode.value) placeHolderGroupFilter.children = [child]

Loading…
Cancel
Save