From efe7098a60b2577bd83276c57f199d4e20e32755 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 25 Nov 2014 19:20:23 +0000 Subject: [PATCH] Fix viewlist to use promises correctly A viewlist wasn't getting properly populated before. This also switches the list update to use splice for in-place updates. --- IPython/html/static/widgets/js/widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/widgets/js/widget.js b/IPython/html/static/widgets/js/widget.js index 394b50dfc..d7bac7623 100644 --- a/IPython/html/static/widgets/js/widget.js +++ b/IPython/html/static/widgets/js/widget.js @@ -579,8 +579,8 @@ define(["widgets/js/manager", } // make a copy of the input array that._models = new_models.slice(); - return Promise.all(added_views, function(added) { - that.views = that.views.slice(0,first_removed).concat(added); + return Promise.all(added_views).then(function(added) { + Array.prototype.splice.apply(that.views, [first_removed, that.views.length].concat(added)); return that.views; }); });