diff --git a/addons/web/static/src/js/views/graph/graph_controller.js b/addons/web/static/src/js/views/graph/graph_controller.js index 2f2919af272..b7bb10ea0c2 100644 --- a/addons/web/static/src/js/views/graph/graph_controller.js +++ b/addons/web/static/src/js/views/graph/graph_controller.js @@ -165,7 +165,7 @@ var GraphController = AbstractController.extend({ .toggleClass('active', !!state.orderBy); if (this.withButtons) { - this._attachDropdownComponents(); + return this._attachDropdownComponents(); } }, @@ -180,6 +180,9 @@ var GraphController = AbstractController.extend({ */ async _attachDropdownComponents() { await Promise.all(this.buttonDropdownPromises); + if (this.isDestroyed()) { + return; + } const actionsContainer = this.$buttons[0]; // Attach "measures" button actionsContainer.appendChild(this.measureMenu.el);