Fix lazy loading on the genre pages (#6799)

* Fix genre tab from sorting shows randomly

* Fix loading elements that have already been loaded

* Fix lazyLoader for show and movie genre tabs

* Reduce time window in which callback may be executed again
This commit is contained in:
Nicholas Jorgenson
2025-04-29 16:06:43 -04:00
committed by GitHub
parent da7135e77a
commit d190fdb27c
3 changed files with 18 additions and 6 deletions
@@ -7,10 +7,10 @@ export class LazyLoader {
createObserver() {
const callback = this.options.callback;
const observer = new IntersectionObserver(
(entries) => {
const newObserver = new IntersectionObserver(
(entries, observer) => {
entries.forEach(entry => {
callback(entry);
callback(entry, observer);
});
},
{
@@ -18,7 +18,7 @@ export class LazyLoader {
threshold: 0
});
this.observer = observer;
this.observer = newObserver;
}
addElements(elements) {
+7 -1
View File
@@ -52,8 +52,14 @@ export default function (view, params, tabContent) {
return !layoutManager.desktop;
}
const fillItemsContainer = (entry) => {
const fillItemsContainer = (entry, observer) => {
if (!entry.isIntersecting) {
return;
}
const elem = entry.target;
observer.unobserve(elem);
const id = elem.getAttribute('data-id');
const viewStyle = this.getCurrentViewStyle();
let limit = viewStyle == 'Thumb' || viewStyle == 'ThumbCard' ? 5 : 9;
+7 -1
View File
@@ -52,8 +52,14 @@ export default function (view, params, tabContent) {
return !layoutManager.desktop;
}
function fillItemsContainer(entry) {
function fillItemsContainer(entry, observer) {
if (!entry.isIntersecting) {
return;
}
const elem = entry.target;
observer.unobserve(elem);
const id = elem.getAttribute('data-id');
const viewStyle = self.getCurrentViewStyle();
let limit = viewStyle == 'Thumb' || viewStyle == 'ThumbCard' ? 5 : 9;