You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/02/27 18:18:34 UTC

[GitHub] graceguo-supercat closed pull request #4485: [dashboard] Fix JS error when position_json data is empty

graceguo-supercat closed pull request #4485: [dashboard] Fix JS error when position_json data is empty
URL: https://github.com/apache/incubator-superset/pull/4485
 
 
   

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/javascripts/dashboard/reducers.js b/superset/assets/javascripts/dashboard/reducers.js
index cbbb26348f..80137c5af0 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)));


 

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