File tree Expand file tree Collapse file tree
superset-frontend/src/embedded Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 */
1919import { DataMaskStateWithId } from '@superset-ui/core' ;
2020import getBootstrapData from 'src/utils/getBootstrapData' ;
21+ import { batch } from 'react-redux' ;
2122import { store } from '../views/store' ;
2223import { getDashboardPermalink as getDashboardPermalinkUtil } from '../utils/urlUtils' ;
2324import { updateDataMask } from '../dataMask/actions' ;
24- import { triggerQuery } from '../components/Chart/chartAction' ;
2525
2626const bootstrapData = getBootstrapData ( ) ;
2727
@@ -69,16 +69,10 @@ const getActiveTabs = () => store?.getState()?.dashboardState?.activeTabs || [];
6969const getDataMask = ( ) => store ?. getState ( ) ?. dataMask || { } ;
7070
7171const setDataMask = ( { dataMask } : { dataMask : DataMaskStateWithId } ) => {
72- const state = store ?. getState ( ) ;
73- const chartIds = state ?. dashboardState ?. sliceIds || [ ] ;
74-
75- Object . entries ( dataMask ) . forEach ( ( [ filterId , mask ] ) => {
76- store ?. dispatch ( updateDataMask ( filterId , mask ) ) ;
77- } ) ;
78-
79- // Trigger query for all charts to apply the new filters
80- chartIds . forEach ( ( chartId : number ) => {
81- store ?. dispatch ( triggerQuery ( true , chartId ) ) ;
72+ batch ( ( ) => {
73+ Object . entries ( dataMask ) . forEach ( ( [ filterId , mask ] ) => {
74+ store ?. dispatch ( updateDataMask ( filterId , mask ) ) ;
75+ } ) ;
8276 } ) ;
8377} ;
8478
You can’t perform that action at this time.
0 commit comments