diff --git a/src/plugins/data/public/actions/value_click_action.ts b/src/plugins/data/public/actions/value_click_action.ts index d51b604a0c392..e346b3a6f0c3e 100644 --- a/src/plugins/data/public/actions/value_click_action.ts +++ b/src/plugins/data/public/actions/value_click_action.ts @@ -88,17 +88,20 @@ export const valueClickActionGetFilters = async ( }> => { if (!(await isCompatible({ timeFieldName, data }))) { throw new IncompatibleActionError(); - } + // note - the else statement is necessary due to odd compilation behavior + // code after the throw statement can't contain await statements + } else { + const filters: Filter[] = + (await createFiltersFromEvent(data.data || [data], data.negate)) || []; - const filters: Filter[] = (await createFiltersFromEvent(data.data || [data], data.negate)) || []; + let selectedFilters: Filter[] = esFilters.mapAndFlattenFilters(filters); - let selectedFilters: Filter[] = esFilters.mapAndFlattenFilters(filters); + if (selectedFilters.length > 1) { + selectedFilters = await filterSelection(filters); + } - if (selectedFilters.length > 1) { - selectedFilters = await filterSelection(filters); + return esFilters.extractTimeFilter(timeFieldName || '', selectedFilters); } - - return esFilters.extractTimeFilter(timeFieldName || '', selectedFilters); }; // gets and applies the filters