From fce399dfd41f48620db38120c3b12d7f5d92af2a Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 22 Aug 2016 11:58:42 -0400 Subject: [PATCH] fix(GUI): "modal.dismiss" is not a function (#645) Steps to reproduce: - Insert a single drive. - Open drive selector modal. - Extract the drive while drive selectector modal is open. - Check DevTools. The solution is to use `.close()` instead of `.dismiss()`. After some diving into the documentation and the code, `.dismiss()` is only available from within the modal controller, however if you want to close the modal from outside, `.close()` is the way to go. Notice that `.close()` returns a rejected promise when being called from the modal itself, but thats not the case from outside, which is quite confusing, but means we can safely use `.close()` in this context. Change-Type: patch Changelog-Entry: Fix "`modal.dismiss` is not a function" exception. Signed-off-by: Juan Cruz Viotti --- lib/gui/components/drive-selector/services/drive-selector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gui/components/drive-selector/services/drive-selector.js b/lib/gui/components/drive-selector/services/drive-selector.js index ed65ecf2..1780cd7f 100644 --- a/lib/gui/components/drive-selector/services/drive-selector.js +++ b/lib/gui/components/drive-selector/services/drive-selector.js @@ -56,7 +56,7 @@ module.exports = function(ModalService, $q) { this.close = () => { if (modal) { - return modal.dismiss(); + return modal.close(); } // Resolve `undefined` if the modal