diff --git a/app/assets/javascripts/discourse/components/topic-entrance.js.es6 b/app/assets/javascripts/discourse/components/topic-entrance.js.es6 index 6e4ba25d148..d72be633d23 100644 --- a/app/assets/javascripts/discourse/components/topic-entrance.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-entrance.js.es6 @@ -92,17 +92,18 @@ export default Ember.Component.extend(CleansUp, { this.appEvents.off('topic-entrance:show'); }, + _jumpTo(destination) { + this.cleanUp(); + DiscourseURL.routeTo(destination); + }, + actions: { enterTop() { - const topic = this.get('topic'); - this.appEvents.trigger('header:update-topic', topic); - DiscourseURL.routeTo(topic.get('url')); + this._jumpTo(this.get('topic.url')); }, enterBottom() { - const topic = this.get('topic'); - this.appEvents.trigger('header:update-topic', topic); - DiscourseURL.routeTo(topic.get('lastPostUrl')); + this._jumpTo(this.get('topic.lastPostUrl')); } } }); diff --git a/app/assets/javascripts/discourse/routes/topic.js.es6 b/app/assets/javascripts/discourse/routes/topic.js.es6 index 7f05b9f3eb8..5a2590d2792 100644 --- a/app/assets/javascripts/discourse/routes/topic.js.es6 +++ b/app/assets/javascripts/discourse/routes/topic.js.es6 @@ -218,6 +218,10 @@ const TopicRoute = Discourse.Route.extend({ // We reset screen tracking every time a topic is entered this.screenTrack.start(model.get('id'), controller); + + Ember.run.scheduleOnce('afterRender', () => { + this.appEvents.trigger('header:update-topic', model); + }); } });