Skip to content
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

Merged
merged 1 commit into from
Jun 21, 2015
Merged

keep loading until you are out of view #44

merged 1 commit into from
Jun 21, 2015

Conversation

kellyselden
Copy link
Collaborator

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.

@@ -69,5 +73,14 @@ export default Ember.Component.extend({
if (this.get('infinityModel.reachedInfinity') && this.get('destroyOnInfinity')) {
this.destroy();
}
}),

infinityModelPushed: Ember.observer('infinityModel.[]', function() {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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?

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

@kellyselden
Copy link
Collaborator Author

Updated to remove the component state.

@hhff
Copy link
Collaborator

hhff commented Jun 21, 2015

Thanks @kellyselden ! Works for me!

hhff added a commit that referenced this pull request Jun 21, 2015
keep loading until you are out of view, closes #10
@hhff hhff merged commit 3870720 into adopted-ember-addons:master Jun 21, 2015
@kellyselden kellyselden deleted the load-more-til-out-of-view branch June 21, 2015 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants