From e389bd8121bdb147c38901e1b5f9b969cfab960e Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 10 Sep 2024 09:51:34 +0100 Subject: [PATCH] Fix for resetting the default config when the groups are cleared --- .../src/components/CoreFilterBuilder.svelte | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/frontend-core/src/components/CoreFilterBuilder.svelte b/packages/frontend-core/src/components/CoreFilterBuilder.svelte index 839b370eca..405373e0a7 100644 --- a/packages/frontend-core/src/components/CoreFilterBuilder.svelte +++ b/packages/frontend-core/src/components/CoreFilterBuilder.svelte @@ -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,