FIX: Issue with double title showing up

This commit is contained in:
Robin Ward 2017-03-23 16:16:36 -04:00
parent 33ed064e59
commit 65081a9193

View File

@ -25,6 +25,7 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
postStream: Ember.computed.alias('topic.postStream'), postStream: Ember.computed.alias('topic.postStream'),
archetype: Ember.computed.alias('topic.archetype'), archetype: Ember.computed.alias('topic.archetype'),
dockAt: 0,
_lastShowTopic: null, _lastShowTopic: null,
@ -109,15 +110,11 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
}, },
resetExamineDockCache() { resetExamineDockCache() {
this.set('docAt', false); this.set('dockAt', 0);
}, },
showTopicInHeader(topic, offset) { showTopicInHeader(topic, offset) {
if (this.get('docAt')) { return offset > this.get('dockAt');
return offset >= this.get('docAt') || topic.get('postStream.firstPostNotLoaded');
} else {
return topic.get('postStream.firstPostNotLoaded');
}
}, },
// The user has scrolled the window, or it is finished rendering and ready for processing. // The user has scrolled the window, or it is finished rendering and ready for processing.
@ -127,10 +124,10 @@ export default Ember.Component.extend(AddArchetypeClass, Scrolling, {
} }
const offset = window.pageYOffset || $('html').scrollTop(); const offset = window.pageYOffset || $('html').scrollTop();
if (!this.get('docAt')) { if (this.get('dockAt') === 0) {
const title = $('#topic-title'); const title = $('#topic-title');
if (title && title.length === 1) { if (title && title.length === 1) {
this.set('docAt', title.offset().top); this.set('dockAt', title.offset().top);
} }
} }