Skip to content

Commit

Permalink
don't wait on loading songs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayman committed Oct 31, 2014
1 parent aeec781 commit 538da2a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions both/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,17 @@ Router.map(function() {

this.route('playlist', {
path: '/playlist/:_id',
onBeforeAction: function() {
subscriptions: function() {
console.log("subscribe to playlist", this.params._id);
this.subscribe('playlist', this.params._id);
this.subscribe('playlist', this.params._id).wait();
var playlist = this.data();
if (!playlist) {
console.warn("no playlist");
return;
}
var songs = playlist.songs || [];
songs = _.pluck(songs, 'songId');
//add another subscription to waiting list
this.subscribe('songs', songs);
this.next();
},
loadingTemplate: 'playlist',
data: function() {
Expand All @@ -64,13 +62,12 @@ Router.map(function() {
});

this.route('loved', {
onBeforeAction: function() {
subscriptions: function() {
var user = Meteor.user();
if (!user)
return;
var songs = user.profile.lovedSongs;
this.subscribe('songs', songs);
this.next();
},
data: {
lovedSongs: function() {
Expand Down

0 comments on commit 538da2a

Please sign in to comment.