Observe repos.firstObject on reposController
Since we change repos property on reposController, we can't set observer on repos, because as soon as it's changed, we loose the observer. Instead, we should observe only on reposController, which is not going to change.
This commit is contained in:
parent
310627cc55
commit
bc4b666d9e
|
@ -3,7 +3,6 @@
|
|||
`import Repo from 'travis/models/repo'`
|
||||
|
||||
Controller = Ember.Controller.extend
|
||||
contentBinding: 'repos'
|
||||
actions:
|
||||
activate: (name) ->
|
||||
@activate(name)
|
||||
|
|
|
@ -12,12 +12,12 @@ Route = TravisRoute.extend
|
|||
@controllerFor('repos').activate(@get('reposTabName'))
|
||||
|
||||
@currentRepoDidChange()
|
||||
if repos = @controllerFor('repos').get('repos')
|
||||
repos.addObserver('firstObject', this, 'currentRepoDidChange')
|
||||
if repos = @controllerFor('repos')
|
||||
repos.addObserver('repos.firstObject', this, 'currentRepoDidChange')
|
||||
|
||||
deactivate: ->
|
||||
if repos = @controllerFor('repos').get('repos')
|
||||
repos.removeObserver('firstObject', this, 'currentRepoDidChange')
|
||||
if repos = @controllerFor('repos')
|
||||
repos.removeObserver('repos.firstObject', this, 'currentRepoDidChange')
|
||||
|
||||
@_super.apply(this, arguments)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user