-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keep loading until you are out of view #44
keep loading until you are out of view #44
Conversation
@@ -69,5 +73,14 @@ export default Ember.Component.extend({ | |||
if (this.get('infinityModel.reachedInfinity') && this.get('destroyOnInfinity')) { | |||
this.destroy(); | |||
} | |||
}), | |||
|
|||
infinityModelPushed: Ember.observer('infinityModel.[]', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably just observe length, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, .[] is the same as .length, but I can't find confirmation. Any insight into this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performancewise it's the same, but slightly different in operation: emberjs/ember.js#2016 (comment)
We probably don't want to trigger loadMore if a developer swaps out an item in the array id say
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that link. I will change.
Updated to remove the component state. |
Thanks @kellyselden ! Works for me! |
keep loading until you are out of view, closes #10
In mobile view, the component is out of view on the first load. In desktop view, there is enough space for the component to load more a few times before being out of view. Currently the loader would not do anything because no scroll events occur.
This change will watch for pushes to the model and keep loading data if it is needed. The desktop view will fill up the screen on first page load.