superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grace...@apache.org
Subject [incubator-superset] branch master updated: [dashboard] Fix JS error when position_json data is empty (#4485)
Date Tue, 27 Feb 2018 18:18:39 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new bcca171  [dashboard] Fix JS error when position_json data is empty (#4485)
bcca171 is described below

commit bcca1717f2014fa631e0713f4b25e2229646dc56
Author: Grace Guo <grace.guo@airbnb.com>
AuthorDate: Tue Feb 27 10:18:32 2018 -0800

    [dashboard] Fix JS error when position_json data is empty (#4485)
---
 superset/assets/javascripts/dashboard/reducers.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/superset/assets/javascripts/dashboard/reducers.js b/superset/assets/javascripts/dashboard/reducers.js
index cbbb263..80137c5 100644
--- a/superset/assets/javascripts/dashboard/reducers.js
+++ b/superset/assets/javascripts/dashboard/reducers.js
@@ -34,10 +34,12 @@ export function getInitialState(bootstrapData) {
 
   dashboard.posDict = {};
   dashboard.layout = [];
-  if (dashboard.position_json) {
+  if (Array.isArray(dashboard.position_json)) {
     dashboard.position_json.forEach((position) => {
       dashboard.posDict[position.slice_id] = position;
     });
+  } else {
+    dashboard.position_json = [];
   }
   const lastRowId = Math.max.apply(null,
     dashboard.position_json.map(pos => (pos.row + pos.size_y)));

-- 
To stop receiving notification emails like this one, please contact
graceguo@apache.org.

Mime
View raw message