-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix lazy loading on the genre pages #6799
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
Conversation
Cloudflare Pages deployment
|
Using I'm assuming this issue is a side-effect from the lazy loader which loads the rows as the user scrolls down. If we want to fix this we should prevent loading rows that have already been loaded. |
Changes
Notes This change will impact movie genres, show genres, and images. |
Awesome, it looks like the lazy loader never even worked as intended for the genres pages and your change fixes it. However, the image loader relies on the multiple execution of the callback in order to fill and empty the image as it intersects and goes out of view. I believe after your change, it'll never get emptied, so I'm thinking we could add an option to the lazy loader e.g |
Third time is the charm! Changes
Notes Image lazy loading functionality seemed to be unaffected by these changes, but please let me know if I missed something. |
@@ -124,6 +128,8 @@ export default function (view, params, tabContent) { | |||
if (result.Items.length >= query.Limit) { | |||
tabContent.querySelector('.btnMoreFromGenre' + id + ' .material-icons').classList.remove('hide'); | |||
} | |||
}).then(() => { | |||
observer.unobserve(elem); |
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.
Calling unobserve after the items were fetched can leave a small window where fillItemsContainer
could be called more than once. I think you can just call unobserve closer to the beginning of the function and that would be fine.
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.
I just made a change to move up the unobserve
closer to the beginning of the function.
|
Changes
Changed the query object's
SortBy
value to beSortName
fromRandom
. This change keeps the ordering of the shows consistent when scrolling to and from a genre section of the genre tab.Issues
Fixes #6779 Genre tab's sorting gets applied each time a row is scrolled into view