Skip to content

Commit

Permalink
Merge pull request #252 from CybercentreCanada/CLDN-1928-filter-incor…
Browse files Browse the repository at this point in the history
…rectly-displays-as-applied

fix: CLDN-1928-Adhoc Filter displays as not applied when empty
  • Loading branch information
cccs-RyanK authored Feb 6, 2023
2 parents 22c8982 + cf3eea4 commit aa4db47
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type DataMaskAction =
filterState: {
label?: string;
filters?: AdhocFilter[];
value: AdhocFilter[];
value?: AdhocFilter[];
};
};

Expand Down Expand Up @@ -182,13 +182,15 @@ export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
),
filterState: {
...filterState,
label: (adhoc_filters || [])
.map(f =>
f.sqlExpression ? String(f.sqlExpression) : labelString(f),
)
.join(', '),
value: adhoc_filters,
filters: adhoc_filters,
label: adhoc_filters?.length
? (adhoc_filters || [])
.map(f =>
f.sqlExpression ? String(f.sqlExpression) : labelString(f),
)
.join(', ')
: undefined,
value: adhoc_filters?.length ? adhoc_filters : undefined,
filters: adhoc_filters?.length ? adhoc_filters : undefined,
},
});
},
Expand Down

0 comments on commit aa4db47

Please sign in to comment.