diff --git a/notebook/static/notebook/js/outputarea.js b/notebook/static/notebook/js/outputarea.js index a6d35d24d..226d72114 100644 --- a/notebook/static/notebook/js/outputarea.js +++ b/notebook/static/notebook/js/outputarea.js @@ -324,10 +324,6 @@ define([ console.log("unrecognized output type: " + json.output_type); this.append_unrecognized(json); } - - if (record_output) { - this.outputs.push(json); - } if (json.output_type === 'display_data') { var that = this; @@ -335,6 +331,10 @@ define([ } else { this.handle_appended(); } + + if (record_output) { + this.outputs.push(json); + } }; OutputArea.prototype.handle_appended = function () { @@ -621,9 +621,7 @@ define([ targets = this._display_id_targets[display_id] = []; } targets.push({ - // output has been appended when this is called, - // so use the index of the last item. - index: this.outputs.length - 1, + index: this.outputs.length, element: element, }); };