From 6ee956367c308eda5fdf43bb777ba1989b5a6633 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 9 Nov 2015 13:24:57 +0100 Subject: [PATCH] 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. --- app/controllers/repos.coffee | 1 - app/routes/main-tab.coffee | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/repos.coffee b/app/controllers/repos.coffee index dd117744..8222a44d 100644 --- a/app/controllers/repos.coffee +++ b/app/controllers/repos.coffee @@ -3,7 +3,6 @@ `import Repo from 'travis/models/repo'` Controller = Ember.Controller.extend - contentBinding: 'repos' actions: activate: (name) -> @activate(name) diff --git a/app/routes/main-tab.coffee b/app/routes/main-tab.coffee index 6cf21fb6..fada43c3 100644 --- a/app/routes/main-tab.coffee +++ b/app/routes/main-tab.coffee @@ -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)