From 8f45f0aeb8dd75445653dba2a36ae508ac58a0c3 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Fri, 16 Oct 2015 14:27:29 -0700 Subject: [PATCH] fix bug where rewriting the directive was deferred and not updated before download --- src/plugins/handlers.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/handlers.js b/src/plugins/handlers.js index e99f237..955380f 100644 --- a/src/plugins/handlers.js +++ b/src/plugins/handlers.js @@ -620,8 +620,15 @@ function handlers(app, opts, done){ const post = content.substring(end, content.length); const newSource = pre + name + post; - documents.update(newSource); - workspace.updateContent(newSource); + workspace.updateContent(newSource) + .then(function(){ + documents.update(newSource); + store.dispatch(creators.updateSelectedDevice(device)); + download(); + }); + // workspace.updateContent is a promise returning function + // so we handle the other stuff in a .then and return here + return; } store.dispatch(creators.updateSelectedDevice(device));