FIX: Double header rendering issues, redux

This commit is contained in:
Robin Ward 2017-06-22 12:50:46 -04:00
parent 94cee37edd
commit b22df9f166
2 changed files with 11 additions and 6 deletions

View File

@ -92,17 +92,18 @@ export default Ember.Component.extend(CleansUp, {
this.appEvents.off('topic-entrance:show'); this.appEvents.off('topic-entrance:show');
}, },
_jumpTo(destination) {
this.cleanUp();
DiscourseURL.routeTo(destination);
},
actions: { actions: {
enterTop() { enterTop() {
const topic = this.get('topic'); this._jumpTo(this.get('topic.url'));
this.appEvents.trigger('header:update-topic', topic);
DiscourseURL.routeTo(topic.get('url'));
}, },
enterBottom() { enterBottom() {
const topic = this.get('topic'); this._jumpTo(this.get('topic.lastPostUrl'));
this.appEvents.trigger('header:update-topic', topic);
DiscourseURL.routeTo(topic.get('lastPostUrl'));
} }
} }
}); });

View File

@ -218,6 +218,10 @@ const TopicRoute = Discourse.Route.extend({
// We reset screen tracking every time a topic is entered // We reset screen tracking every time a topic is entered
this.screenTrack.start(model.get('id'), controller); this.screenTrack.start(model.get('id'), controller);
Ember.run.scheduleOnce('afterRender', () => {
this.appEvents.trigger('header:update-topic', model);
});
} }
}); });