diff --git a/src/kibana/apps/dashboard/directives/grid.js b/src/kibana/apps/dashboard/directives/grid.js index 7958eac72cf10..67e67e6a78969 100644 --- a/src/kibana/apps/dashboard/directives/grid.js +++ b/src/kibana/apps/dashboard/directives/grid.js @@ -190,7 +190,10 @@ define(function (require) { g.generate_stylesheet({ namespace: '.gridster' }); g.get_widgets_from_DOM(); - g.set_dom_grid_height(); + // We can't call this method if the gridmap is empty. This was found + // when the user double clicked the "New Dashboard" icon. See + // https://github.com/elasticsearch/kibana4/issues/390 + if (gridster.gridmap.length > 0) g.set_dom_grid_height(); g.drag_api.set_limits(COLS * g.min_widget_width); }; @@ -200,6 +203,7 @@ define(function (require) { readGridsterChangeHandler(); complete(); }; + var safeLayout = _.debounce(layout, 200); init(); @@ -207,4 +211,4 @@ define(function (require) { }; }); -}); \ No newline at end of file +});