diff --git a/js/stores/edition_list_store.js b/js/stores/edition_list_store.js index f5430d6c..90f48e8f 100644 --- a/js/stores/edition_list_store.js +++ b/js/stores/edition_list_store.js @@ -133,9 +133,17 @@ class EditionListStore { } onToggleEditionList(pieceId) { + this.isEditionListOpenForPieceId[pieceId] = { show: this.isEditionListOpenForPieceId[pieceId] ? !this.isEditionListOpenForPieceId[pieceId].show : true }; + + if(!this.isEditionListOpenForPieceId[pieceId].show) { + // to clear an array, david walsh recommends to just set it's length to zero + // http://davidwalsh.name/empty-array + + this.editionList[pieceId].length = 0; + } } onCloseAllEditionLists() {