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

Use abs position when checking if element is visible in viewport #437

Merged

Conversation

trevordevore
Copy link
Contributor

While implementing ember-infinity in my project I noticed that the <InfinityLoader> would be in view but would not load new records. One simple way of testing this was to have an endpoint that returns 1 record per page. ember-infinity loads the first page, <InfinityLoader> remains in view, and no new records are loaded.

This PR contains the fix I came up with which resolve the issue.

clientHeight doesn't tell us anything about where the viewPortElem is located in the window relative to where this.elem is located. Using absolute values ensures that _debounceScrolledToBottom() is always called when the <InfinityLoader> component is in view.

`clientHeight` doesn't tell us anything about where the `viewPortElem` is located in the window relative to where `this.elem` is located. Using absolute values ensures that `_debounceScrolledToBottom()` is always called when the `infinity-loader` component is in view.
Copy link
Collaborator

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this PR. Thank yoU!

@snewcomer snewcomer merged commit ad2f069 into adopted-ember-addons:master May 19, 2021
@trevordevore trevordevore deleted the fix_checkscrollableheight branch February 18, 2023 14:27
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.

2 participants