Bug 1149869 - Prevent duplicate readinglist items from appearing in the sidebar in some cases. r=Unfocused, a=sledru
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 01 Apr 2015 17:03:53 +1100
changeset 258401 881a59941b04
parent 258400 0ff855a44d9c
child 258402 bf83a8535bf4
push id4659
push userryanvm@gmail.com
push date2015-04-09 15:23 +0000
treeherdermozilla-beta@58dca3f7560a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused, sledru
bugs1149869
milestone38.0
Bug 1149869 - Prevent duplicate readinglist items from appearing in the sidebar in some cases. r=Unfocused, a=sledru
browser/components/readinglist/sidebar.js
--- a/browser/components/readinglist/sidebar.js
+++ b/browser/components/readinglist/sidebar.js
@@ -113,20 +113,22 @@ let RLSidebar = {
   /**
    * Handle an item being deleted from the ReadingList.
    * @param {ReadingListItem} item - Item that was deleted.
    */
   onItemDeleted(item) {
     log.trace(`onItemDeleted: ${item}`);
 
     let itemNode = this.itemNodesById.get(item.id);
+
+    this.itemNodesById.delete(item.id);
+    this.itemsById.delete(item.id);
+
     itemNode.addEventListener('transitionend', (event) => {
       if (event.propertyName == "max-height") {
-        this.itemNodesById.delete(item.id);
-        this.itemsById.delete(item.id);
         itemNode.remove();
 
         // TODO: ensureListItems doesn't yet cope with needing to add one item.
         //this.ensureListItems();
 
         this.emptyListInfo.hidden = (this.numItems > 0);
       }
     }, false);