FIX: Not tracking posts that dynamically load

This commit is contained in:
Robin Ward 2016-02-11 16:23:41 -05:00
parent a0d61ebf7f
commit 4e209846cb
2 changed files with 2 additions and 1 deletions

View file

@ -124,6 +124,7 @@ export default MountWidget.extend({
this._super(); this._super();
const debouncedScroll = () => Ember.run.debounce(this, this._scrollTriggered, 10); const debouncedScroll = () => Ember.run.debounce(this, this._scrollTriggered, 10);
this.appEvents.on('post-stream:refresh', debouncedScroll);
$(document).bind('touchmove.post-stream', debouncedScroll); $(document).bind('touchmove.post-stream', debouncedScroll);
$(window).bind('scroll.post-stream', debouncedScroll); $(window).bind('scroll.post-stream', debouncedScroll);
this._scrollTriggered(); this._scrollTriggered();
@ -152,6 +153,7 @@ export default MountWidget.extend({
this.appEvents.off('post-stream:refresh'); this.appEvents.off('post-stream:refresh');
this.$().off('mouseenter.post-stream'); this.$().off('mouseenter.post-stream');
this.$().off('mouseleave.post-stream'); this.$().off('mouseleave.post-stream');
this.appEvents.off('post-stream:refresh');
} }
}); });

View file

@ -7,7 +7,6 @@ const DAY = 1000 * 60 * 60 * 24;
export default createWidget('post-stream', { export default createWidget('post-stream', {
tagName: 'div.post-stream', tagName: 'div.post-stream',
html(attrs) { html(attrs) {
const posts = attrs.posts || []; const posts = attrs.posts || [];
const postArray = posts.toArray(); const postArray = posts.toArray();