superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccwilli...@apache.org
Subject [incubator-superset] 16/26: Fix: update slices list when add/remove multiple slices (#5138)
Date Fri, 22 Jun 2018 00:54:31 GMT
This is an automated email from the ASF dual-hosted git repository.

ccwilliams pushed a commit to branch dashboard-builder
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit a61f6f7d0483fd80c7d272e93f5c97a01d935e4e
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Tue Jun 5 10:40:56 2018 -0700

    Fix: update slices list when add/remove multiple slices (#5138)
---
 superset/assets/src/dashboard/components/Dashboard.jsx | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/superset/assets/src/dashboard/components/Dashboard.jsx b/superset/assets/src/dashboard/components/Dashboard.jsx
index 76f4b54..62bcbb5 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),
+        );
+      }
     }
   }
 


Mime
View raw message