Fix for resetting the default config when the groups are cleared

This commit is contained in:
Dean 2024-09-10 09:51:34 +01:00
parent 162d0d0c7e
commit e389bd8121
1 changed files with 6 additions and 8 deletions

View File

@ -39,12 +39,6 @@
export let toReadable
export let toRuntime
const defaultConf = {
logicalOperator: FilterGroupLogicalOperator.ALL,
onEmptyFilter: EmptyFilterOption.RETURN_NONE,
groups: [],
}
$: editableFilters = filters ? Helpers.cloneDeep(filters) : null
$: {
@ -218,8 +212,12 @@
}
}
} else if (addGroup) {
if (!editable) {
editable = defaultConf
if (!editable?.groups?.length) {
editable = {
logicalOperator: FilterGroupLogicalOperator.ALL,
onEmptyFilter: EmptyFilterOption.RETURN_NONE,
groups: [],
}
}
editable.groups.push({
logicalOperator: Constants.FilterOperator.ANY,