FIX: On long browsers, you could get a double title

This commit is contained in:
Robin Ward 2017-03-31 13:00:52 -04:00
parent 2418daeb63
commit 62be121328
3 changed files with 10 additions and 3 deletions

View File

@ -37,7 +37,7 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
const enteredAt = this.get('enteredAt');
if (enteredAt && (this.get('lastEnteredAt') !== enteredAt)) {
this._lastShowTopic = null;
this.scrolled();
Ember.run.schedule('afterRender', () => this.scrolled());
this.set('lastEnteredAt', enteredAt);
}
},
@ -131,20 +131,21 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
}
}
this.set('hasScrolled', offset > 0);
const topic = this.get('topic');
const showTopic = this.showTopicInHeader(topic, offset);
if (showTopic !== this._lastShowTopic) {
this._lastShowTopic = showTopic;
if (showTopic) {
this.appEvents.trigger('header:show-topic', topic);
this._lastShowTopic = true;
} else {
if (!DiscourseURL.isJumpScheduled()) {
const loadingNear = topic.get('postStream.loadingNearPost') || 1;
if (loadingNear === 1) {
this.appEvents.trigger('header:hide-topic');
this._lastShowTopic = false;
}
}
}

View File

@ -55,6 +55,8 @@ export default class LockOn {
const interval = setInterval(() => {
let top = this.elementTop();
if (top < 0) { top = 0; }
const scrollTop = $(window).scrollTop();
if (typeof(top) === "undefined" || isNaN(top)) {

View File

@ -108,6 +108,10 @@ const DiscourseURL = Ember.Object.extend({
}
lockon.lock();
if (lockon.elementTop() < 1) {
_transitioning = false;
return;
}
});
},