From e7052aebe40d6b7d39122c83354b86914d97e563 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 26 Dec 2013 13:02:53 -0800 Subject: [PATCH] Moved reqres for GetEpisodeFileById outside of the collection fetches --- src/UI/Cells/EpisodeStatusCell.js | 2 +- src/UI/Series/Details/SeriesDetailsLayout.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/UI/Cells/EpisodeStatusCell.js b/src/UI/Cells/EpisodeStatusCell.js index c0d8bb705..8a7fc89ac 100644 --- a/src/UI/Cells/EpisodeStatusCell.js +++ b/src/UI/Cells/EpisodeStatusCell.js @@ -31,7 +31,7 @@ define( var hasAired = Moment(this.model.get('airDateUtc')).isBefore(Moment()); var hasFile = this.model.get('hasFile'); - if (hasFile) { + if (hasFile && reqres.hasHandler(reqres.Requests.GetEpisodeFileById)) { var episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId')); this.listenTo(episodeFile, 'change', this._refresh); diff --git a/src/UI/Series/Details/SeriesDetailsLayout.js b/src/UI/Series/Details/SeriesDetailsLayout.js index bc2d77b58..c54e777fb 100644 --- a/src/UI/Series/Details/SeriesDetailsLayout.js +++ b/src/UI/Series/Details/SeriesDetailsLayout.js @@ -186,6 +186,10 @@ define( this.episodeCollection = new EpisodeCollection({ seriesId: this.model.id }).bindSignalR(); this.episodeFileCollection = new EpisodeFileCollection({ seriesId: this.model.id }).bindSignalR(); + reqres.setHandler(reqres.Requests.GetEpisodeFileById, function (episodeFileId) { + return self.episodeFileCollection.get(episodeFileId); + }); + $.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function () { var seasonCollectionView = new SeasonCollectionView({ collection : self.seasonCollection, @@ -193,10 +197,6 @@ define( series : self.model }); - reqres.setHandler(reqres.Requests.GetEpisodeFileById, function (episodeFileId) { - return self.episodeFileCollection.get(episodeFileId); - }); - self.seasons.show(seasonCollectionView); }); },