diff --git a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 b/app/assets/javascripts/discourse/components/discourse-topic.js.es6 index 5a07d9516dc..4c717b30493 100644 --- a/app/assets/javascripts/discourse/components/discourse-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/discourse-topic.js.es6 @@ -142,7 +142,10 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, { this.appEvents.trigger('header:show-topic', topic); } else { if (!DiscourseURL.isJumpScheduled()) { - this.appEvents.trigger('header:hide-topic'); + const loadingNear = topic.get('postStream.loadingNearPost') || 1; + if (loadingNear === 1) { + this.appEvents.trigger('header:hide-topic'); + } } } } diff --git a/app/assets/javascripts/discourse/components/topic-entrance.js.es6 b/app/assets/javascripts/discourse/components/topic-entrance.js.es6 index d3b5983ce43..6e4ba25d148 100644 --- a/app/assets/javascripts/discourse/components/topic-entrance.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-entrance.js.es6 @@ -94,11 +94,15 @@ export default Ember.Component.extend(CleansUp, { actions: { enterTop() { - DiscourseURL.routeTo(this.get('topic.url')); + const topic = this.get('topic'); + this.appEvents.trigger('header:update-topic', topic); + DiscourseURL.routeTo(topic.get('url')); }, enterBottom() { - DiscourseURL.routeTo(this.get('topic.lastPostUrl')); + const topic = this.get('topic'); + this.appEvents.trigger('header:update-topic', topic); + DiscourseURL.routeTo(topic.get('lastPostUrl')); } } }); diff --git a/app/assets/javascripts/discourse/models/post-stream.js.es6 b/app/assets/javascripts/discourse/models/post-stream.js.es6 index 32cfa6427f7..0e9a5863038 100644 --- a/app/assets/javascripts/discourse/models/post-stream.js.es6 +++ b/app/assets/javascripts/discourse/models/post-stream.js.es6 @@ -15,6 +15,7 @@ export default RestModel.extend({ loadingAbove: null, loadingBelow: null, loadingFilter: null, + loadingNearPost: null, stagingPost: null, postsWithPlaceholders: null, timelineLookup: null, @@ -206,6 +207,7 @@ export default RestModel.extend({ // TODO: if we have all the posts in the filter, don't go to the server for them. this.set('loadingFilter', true); + this.set('loadingNearPost', opts.nearPost); opts = _.merge(opts, this.get('streamFilters')); @@ -216,6 +218,8 @@ export default RestModel.extend({ }).catch(result => { this.errorLoading(result); throw result; + }).finally(() => { + this.set('loadingNearPost', null); }); },