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

View File

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

View File

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