This is an automated email from the ASF dual-hosted git repository. diegopucci pushed a commit to branch geido/fix/cross-filtering-jinja in repository https://gitbox.apache.org/repos/asf/superset.git
commit 260e024ce928814ca15bcbc83c28e7c43c9e9fb4 Author: Diego Pucci <[email protected]> AuthorDate: Fri Oct 25 17:58:09 2024 +0300 fix(CrossFilters): Let backend handle adhoc filters --- superset-frontend/src/dashboard/util/getRelatedCharts.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/superset-frontend/src/dashboard/util/getRelatedCharts.ts b/superset-frontend/src/dashboard/util/getRelatedCharts.ts index aba56ba3b6..c019baf98e 100644 --- a/superset-frontend/src/dashboard/util/getRelatedCharts.ts +++ b/superset-frontend/src/dashboard/util/getRelatedCharts.ts @@ -30,12 +30,13 @@ import { Slice } from 'src/types/Chart'; import { DatasourcesState } from '../types'; function checkForExpression(formData?: Record<string, any>) { - const groupby = ensureIsArray(formData?.groupby) ?? []; - const allColumns = ensureIsArray(formData?.all_columns) ?? []; - const checkColumns = groupby.concat(allColumns); - return checkColumns.some( - (col: string | Record<string, any>) => - typeof col !== 'string' && col.expressionType !== undefined, + const groupby = ensureIsArray(formData?.groupby); + const allColumns = ensureIsArray(formData?.all_columns); + const adhocFilters = ensureIsArray(formData?.adhoc_filters); + const checkExpressions = groupby.concat(allColumns).concat(adhocFilters); + return checkExpressions.some( + (ex: string | Record<string, any>) => + ex && typeof ex === 'object' && ex.expressionType === 'SQL', ); }
