Skip to content

Commit

Permalink
[dashboard] Fix JS error when position_json data is empty (apache#4485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored and michellethomas committed May 23, 2018
1 parent cd78142 commit d318ca2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion superset/assets/javascripts/dashboard/reducers.js
Expand Up @@ -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)));
Expand Down

0 comments on commit d318ca2

Please sign in to comment.