From 620890389df0c19271d38f6ddea224ecc6440e5c Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 9 Aug 2013 17:14:30 +0000 Subject: [PATCH] properly mutate history after adding clips --- static/js/utils.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/static/js/utils.js b/static/js/utils.js index f40e862c..6079b913 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -351,9 +351,6 @@ pandora.createLinks = function($element) { } } function done(result, addedItems) { - if (object.action == 'join' || object.action == 'split') { - object.items[1] = addedItems; - } doneHistory(object, callback); } }; @@ -376,9 +373,6 @@ pandora.createLinks = function($element) { } } function done(result, addedItems) { - if (object.action == 'join' || object.action == 'split') { - object.items[0] = addedItems; - } doneHistory(object, callback); } }; @@ -407,7 +401,9 @@ pandora.createLinks = function($element) { }); } else { pandora.api.addClips({clips: getClipData(items), edit: target, index: 0}, function(result) { - callback(result, getClipItems(result.data.clips)); + // adding clips creates new ids, so mutate items in history + items.splice.apply(items, [0, items.length].concat(getClipItems(result.data.clips))); + callback(result, items); }); } }