Skip to content

Commit

Permalink
fixes #89, refresh songview when tracks added to currently viewed pla…
Browse files Browse the repository at this point in the history
…ylist
  • Loading branch information
benkaiser committed Jan 19, 2016
1 parent 3e3d907 commit e5daa50
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions static/js/player/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ socket.on('playlists', function(data) {
// redraw the sidebar
MusicApp.router.sidebar();

// when they are viewing a playlist that has been updated, refresh it
data.playlists.forEach(function(playlist, index) {
if (player.playlist &&
player.playlist.title === playlist.title &&
player.playlist.songs.length !== playlist.songs.length) {
// trigger a re-route, this will refresh the songview
MusicApp.router.playlist(playlist._id);
}
});

// restart the router if we are loading for the first time
loadedRestart('playlists');
});
Expand Down

0 comments on commit e5daa50

Please sign in to comment.