From 49fbb506414a0116b46a99ef35eee53333393004 2014-12-02 23:32:19 From: Jonathan Frederic Date: 2014-12-02 23:32:19 Subject: [PATCH] Merge pull request #7081 from jasongrout/view-promises Wait for any promises returned by a view's render method before considering the view created --- diff --git a/IPython/html/static/widgets/js/manager.js b/IPython/html/static/widgets/js/manager.js index e7ee686..c0f17fb 100644 --- a/IPython/html/static/widgets/js/manager.js +++ b/IPython/html/static/widgets/js/manager.js @@ -101,8 +101,7 @@ define([ var parameters = {model: model, options: options}; var view = new ViewType(parameters); view.listenTo(model, 'destroy', view.remove); - view.render(); - return view; + return Promise.resolve(view.render()).then(function() {return view;}); }).catch(utils.reject("Couldn't create a view for model id '" + String(model.id) + "'", true)); }); return model.state_change;