diff --git a/client/app/components/dashboards/widget.js b/client/app/components/dashboards/widget.js index 0faac7f8..1054db79 100644 --- a/client/app/components/dashboards/widget.js +++ b/client/app/components/dashboards/widget.js @@ -71,7 +71,8 @@ function DashboardWidgetCtrl($location, $uibModal, $window, Events, currentUser) Events.record('delete', 'widget', this.widget.id); this.widget.$delete((response) => { - this.dashboard.widgets = this.dashboard.widgets.filter(widget => widget.id !== undefined); + this.dashboard.widgets = this.dashboard.widgets + .filter(widget => (widget.id !== undefined) && (widget.id !== this.widget.id)); this.dashboard.version = response.version; if (this.deleted) { this.deleted({}); diff --git a/client/app/pages/dashboards/dashboard.js b/client/app/pages/dashboards/dashboard.js index 8ba12e47..fd9b9a8d 100644 --- a/client/app/pages/dashboards/dashboard.js +++ b/client/app/pages/dashboards/dashboard.js @@ -317,7 +317,11 @@ function DashboardCtrl( this.removeWidget = () => { this.extractGlobalParameters(); if (!this.layoutEditing) { - saveDashboardLayout(); + // We need to wait a bit for `angular-gridster` before it updates widgets, + // and only then save new layout + $timeout(() => { + saveDashboardLayout(); + }, 50); } };