villebro commented on a change in pull request #15424:
URL: https://github.com/apache/superset/pull/15424#discussion_r660376119



##########
File path: superset-frontend/src/dashboard/components/FiltersBadge/selectors.ts
##########
@@ -147,11 +144,10 @@ export const selectIndicatorsForChart = (
   chartId: number,
   filters: { [key: number]: Filter },
   datasources: { [key: string]: Datasource },
-  charts: any,
+  chart: any,
 ): Indicator[] => {
-  const chart = charts[chartId];
-  // no indicators if chart is loading
-  if (chart.chartStatus === 'loading') return [];
+  // no indicators before chart is rendered
+  if (chart.chartStatus !== 'rendered') return [];

Review comment:
       This change (and the other one for native filters) removes the indicator 
if no results are returned:
   
   ### BEFORE
   
![image](https://user-images.githubusercontent.com/33317356/123759998-1c509000-d8c9-11eb-87c9-865b8e327def.png)
   
   ### AFTER
   
![image](https://user-images.githubusercontent.com/33317356/123760129-3ab68b80-d8c9-11eb-8a3d-642fb6df871c.png)
   
   This should probably either be left unchanged, or changed to 
   ```js
     if (!['rendered', 'success'].includes(chart.chartStatus) return [];
   ```

##########
File path: superset-frontend/src/dashboard/components/FiltersBadge/selectors.ts
##########
@@ -147,11 +144,10 @@ export const selectIndicatorsForChart = (
   chartId: number,
   filters: { [key: number]: Filter },
   datasources: { [key: string]: Datasource },
-  charts: any,
+  chart: any,
 ): Indicator[] => {
-  const chart = charts[chartId];
-  // no indicators if chart is loading
-  if (chart.chartStatus === 'loading') return [];
+  // no indicators before chart is rendered
+  if (chart.chartStatus !== 'rendered') return [];

Review comment:
       This change (and the other one for native filters) removes the indicator 
if no results are returned:
   
   ### BEFORE
   
![image](https://user-images.githubusercontent.com/33317356/123759998-1c509000-d8c9-11eb-87c9-865b8e327def.png)
   
   ### AFTER
   
![image](https://user-images.githubusercontent.com/33317356/123760129-3ab68b80-d8c9-11eb-8a3d-642fb6df871c.png)
   
   This should probably either be left unchanged, or changed to 
   ```js
     if (!['rendered', 'success'].includes(chart.chartStatus)) return [];
   ```




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to