graceguo-supercat commented on a change in pull request #8404: 
[WIP][feature]Dashboard filter scope selector modal
URL: 
https://github.com/apache/incubator-superset/pull/8404#discussion_r342835993
 
 

 ##########
 File path: superset/assets/src/dashboard/util/activeDashboardFilters.js
 ##########
 @@ -17,14 +17,31 @@
  * under the License.
  */
 let activeFilters = {};
+let allFilterBoxChartIds = [];
 
 export function getActiveFilters() {
   return activeFilters;
 }
 
+// currently filterbox is a chart,
+// when define filter scopes, they have to be out pulled out in a few places.
+// after we make filterbox a dashboard build-in component,
+// will not need this check anymore
+export function isFilterBox(chartId) {
+  return allFilterBoxChartIds.includes(chartId);
+}
+
+export function getAllFilterBoxChartIds() {
+  return allFilterBoxChartIds;
+}
+
 // non-empty filters from dashboardFilters,
 // this function does not take into account: filter immune or filter scope 
settings
 export function buildActiveFilters(allDashboardFilters = {}) {
+  allFilterBoxChartIds = Object.values(allDashboardFilters).map(
 
 Review comment:
   it's called in getInitState and reducers function, whenever dashboardFilters 
state is changed. This closure is trying to simulate a singleton design 
pattern, and `getActiveFilters` is used by many frequently re-rendered 
components.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to