You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/06/05 17:40:57 UTC

[GitHub] williaster closed pull request #5138: Fix: update slices list on add/remove multiple slices

williaster closed pull request #5138: Fix: update slices list on add/remove multiple slices
URL: https://github.com/apache/incubator-superset/pull/5138
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/dashboard/components/Dashboard.jsx b/superset/assets/src/dashboard/components/Dashboard.jsx
index 76f4b54add..62bcbb5ef1 100644
--- a/superset/assets/src/dashboard/components/Dashboard.jsx
+++ b/superset/assets/src/dashboard/components/Dashboard.jsx
@@ -129,16 +129,24 @@ class Dashboard extends React.PureComponent {
 
     if (currentChartIds.length < nextChartIds.length) {
       // adding new chart
-      const newChartId = nextChartIds.find(
+      const newChartIds = nextChartIds.filter(
         key => currentChartIds.indexOf(key) === -1,
       );
-      this.props.actions.addSliceToDashboard(newChartId);
+      if (newChartIds.length) {
+        newChartIds.forEach(newChartId =>
+          this.props.actions.addSliceToDashboard(newChartId),
+        );
+      }
     } else if (currentChartIds.length > nextChartIds.length) {
       // remove chart
-      const removedChartId = currentChartIds.find(
+      const removedChartIds = currentChartIds.filter(
         key => nextChartIds.indexOf(key) === -1,
       );
-      this.props.actions.removeSliceFromDashboard(removedChartId);
+      if (removedChartIds.length) {
+        removedChartIds.forEach(removedChartId =>
+          this.props.actions.removeSliceFromDashboard(removedChartId),
+        );
+      }
     }
   }
 


 

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org