Add new item before destroying pending item

Fixes atom/tabs#278

Signed-off-by: Michelle Tilley <binarymuse@github.com>
This commit is contained in:
Katrina Uychaco
2016-03-03 17:46:02 -08:00
committed by Michelle Tilley
parent 2bdf4be904
commit e620232d35
2 changed files with 29 additions and 5 deletions

View File

@@ -433,11 +433,11 @@ class Pane extends Model
@subscriptionsPerItem.set item, itemSubscriptions
@items.splice(index, 0, item)
pendingItem = @getPendingItem()
@destroyItem(pendingItem) if pendingItem?
lastPendingItem = @getPendingItem()
@setPendingItem(item) if pending
@emitter.emit 'did-add-item', {item, index, moved}
@destroyItem(lastPendingItem) if lastPendingItem?
@setActiveItem(item) unless @getActiveItem()?
item