fix(cross-filters): only apply filters if ff is set (#13704)
* fix(cross-filters): only apply filters if ff is set * fix missing parent
This commit is contained in:
parent
95a017aa2d
commit
1a67f1564c
|
|
@ -51,8 +51,9 @@ export function useFilterScopeTree(
|
|||
const validNodes = useMemo(
|
||||
() =>
|
||||
Object.values(layout).reduce<string[]>((acc, cur) => {
|
||||
if (cur?.type === CHART_TYPE && currentChartId !== cur?.meta?.chartId) {
|
||||
return [...new Set([...acc, ...cur?.parents, cur.id])];
|
||||
const { id, parents = [], type, meta } = cur;
|
||||
if (type === CHART_TYPE && currentChartId !== meta?.chartId) {
|
||||
return [...new Set([...acc, ...parents, id])];
|
||||
}
|
||||
return acc;
|
||||
}, []),
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
import { DataMaskType, MaskWithId } from './types';
|
||||
import { FilterConfiguration } from '../dashboard/components/nativeFilters/types';
|
||||
import { FeatureFlag, isFeatureEnabled } from '../featureFlags';
|
||||
|
||||
export const UPDATE_DATA_MASK = 'UPDATE_DATA_MASK';
|
||||
export interface UpdateDataMask {
|
||||
|
|
@ -50,10 +51,22 @@ export function updateDataMask(
|
|||
ownFilters?: Omit<MaskWithId, 'id'>;
|
||||
},
|
||||
): UpdateDataMask {
|
||||
const { nativeFilters, crossFilters, ownFilters } = dataMask;
|
||||
const filteredDataMask: {
|
||||
nativeFilters?: Omit<MaskWithId, 'id'>;
|
||||
crossFilters?: Omit<MaskWithId, 'id'>;
|
||||
ownFilters?: Omit<MaskWithId, 'id'>;
|
||||
} = { ownFilters };
|
||||
if (isFeatureEnabled(FeatureFlag.DASHBOARD_NATIVE_FILTERS) && nativeFilters) {
|
||||
filteredDataMask.nativeFilters = nativeFilters;
|
||||
}
|
||||
if (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) && crossFilters) {
|
||||
filteredDataMask.crossFilters = crossFilters;
|
||||
}
|
||||
return {
|
||||
type: UPDATE_DATA_MASK,
|
||||
filterId,
|
||||
...dataMask,
|
||||
...filteredDataMask,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue