Adding to playlists... seems buggy

This commit is contained in:
James Barnsley
2017-01-16 21:49:04 +13:00
parent cb41a24dbd
commit 2906e782c7
3 changed files with 9 additions and 5 deletions

View File

@ -107,10 +107,12 @@ class ContextMenu extends React.Component{
renderPlaylistSubmenu(){
var playlists = []
for( var i = 0; i < this.props.playlists.length; i++ ){
if( this.props.playlists[i].can_edit ) playlists.push( this.props.playlists[i] )
for (var uri in this.props.playlists){
if (this.props.playlists[uri].can_edit) playlists.push( this.props.playlists[uri])
}
playlists = helpers.sortItems(playlists, 'name')
return (
<div className="submenu">
{

View File

@ -18,10 +18,12 @@ export default class AddToPlaylistModal extends React.Component{
render(){
if( !this.props.playlists ) return <div className="empty">No editable playlists</div>
var playlists = []
for( var i = 0; i < this.props.playlists.length; i++ ){
if( this.props.playlists[i].can_edit ) playlists.push( this.props.playlists[i] )
for (var uri in this.props.playlists){
if( this.props.playlists[uri].can_edit ) playlists.push( this.props.playlists[uri] )
}
playlists = helpers.sortItems(playlists, 'name')
return (
<div>
<h4>Add to playlist</h4>

View File

@ -351,7 +351,7 @@ export let sortItems = function (array, property, reverse = false){
}
}
var sorted = array.sort(compare)
var sorted = Object.assign([], array.sort(compare))
if( reverse ) sorted.reverse()
return sorted
}