Fix play buttons not appearing sometimes on navigation

Repro steps:

* Go to a ladder page
* Click to play
* Click link back to ladder
* Before, the play buttons would not appear, now they do.
This commit is contained in:
Scott Erickson 2016-08-30 16:05:25 -07:00
parent 3387e5ee34
commit f57ec17261

View file

@ -41,10 +41,12 @@ module.exports = class LadderView extends RootView
initialize: (options, @levelID, @leagueType, @leagueID) ->
@level = @supermodel.loadModel(new Level(_id: @levelID)).model
@level.once 'sync', =>
onLoaded = =>
return if @destroyed
@levelDescription = marked(@level.get('description')) if @level.get('description')
@teams = teamDataFromLevel @level
if @level.loaded then onLoaded() else @level.once('sync', onLoaded)
@sessions = @supermodel.loadCollection(new LevelSessionsCollection(@levelID), 'your_sessions', {cache: false}).model
@winners = require('./tournament_results')[@levelID]