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