Skip to content

Commit

Permalink
prevent undefined filterQuery error (#113522) (#113818)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Sergi Massaneda <sergi.massaneda@elastic.co>
  • Loading branch information
kibanamachine and semd authored Oct 4, 2021
1 parent a5acdf5 commit dad2009
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions x-pack/plugins/timelines/public/components/t_grid/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,22 @@ export const getCombinedFilterQuery = ({
to,
filters,
...combineQueriesParams
}: CombineQueries & { from: string; to: string }): string => {
return replaceStatusField(
}: CombineQueries & { from: string; to: string }): string =>
replaceStatusField(
combineQueries({
...combineQueriesParams,
filters: [...filters, buildTimeRangeFilter(from, to)],
})!.filterQuery
})?.filterQuery
);
};

/**
* This function is a temporary patch to prevent queries using old `signal.status` field.
* @todo The `signal.status` field should not be queried anymore and
* must be replaced by `ALERT_WORKFLOW_STATUS` field name constant
* @deprecated
*/
const replaceStatusField = (query: string): string =>
query.replaceAll('signal.status', ALERT_WORKFLOW_STATUS);
const replaceStatusField = (filterQuery?: string): string =>
filterQuery?.replaceAll('signal.status', ALERT_WORKFLOW_STATUS) ?? '';

/**
* The CSS class name of a "stateful event", which appears in both
Expand Down

0 comments on commit dad2009

Please sign in to comment.