Skip to content

Commit

Permalink
more readable code
Browse files Browse the repository at this point in the history
  • Loading branch information
logeekal committed Aug 10, 2022
1 parent e5d5316 commit 92f0094
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,8 @@ export const getAddToTimelineCellAction = ({

const dataProvider: DataProvider[] = useMemo(() => {
const queryIdPrefix = `${escapeDataProviderId(columnId)}-row-${rowIndex}-col-${columnId}`;
return (
value?.map((x) => ({
and: [],
enabled: true,
excluded: false,
kqlQuery: '',
id: `${queryIdPrefix}-val-${x}`,
name: x,
queryMatch: {
field: columnId,
value: x,
operator: IS_OPERATOR,
},
})) ?? [
if (!value) {
return [
{
and: [],
enabled: true,
Expand All @@ -73,8 +61,21 @@ export const getAddToTimelineCellAction = ({
operator: EXISTS_OPERATOR,
},
},
]
);
];
}
return value.map((x) => ({
and: [],
enabled: true,
excluded: false,
kqlQuery: '',
id: `${queryIdPrefix}-val-${x}`,
name: x,
queryMatch: {
field: columnId,
value: x,
operator: IS_OPERATOR,
},
}));
}, [columnId, rowIndex, value]);
const addToTimelineProps = useMemo(() => {
return {
Expand Down

0 comments on commit 92f0094

Please sign in to comment.