Fix: A case where when using multiple cards some would not render

pull/16/head
Juraj Nyíri 4 years ago
parent 858ea0a11b
commit b15c226e22

@ -19629,7 +19629,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
window.addEventListener('scroll', () => {
const loadAdditionalRowsCount = 2; // todo: make this configurable
const height = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
if (window.innerHeight + window.scrollY > height - 300) {
if (window.innerHeight + window.scrollY > height - 300 && this.renderedItems > 0) {
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems();
this.calculatePositions();
@ -19749,9 +19749,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.columnsCount = this.renderedItems - 1;
}
lastRowTop = movieElem.getBoundingClientRect().top;
if (!isScrolledIntoView(movieElem) && !this.maxRenderCount) {
if (!isScrolledIntoView(movieElem) && !this.maxRenderCount && this.renderedItems > 0) {
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * loadAdditionalRowsCount;
console.log(`Set max render this.renderedItems to ${this.maxRenderCount}`);
}
}
}

@ -111,7 +111,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
document.documentElement.scrollHeight,
document.documentElement.offsetHeight
);
if (window.innerHeight + window.scrollY > height - 300) {
if (window.innerHeight + window.scrollY > height - 300 && this.renderedItems > 0) {
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems();
@ -244,9 +244,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.columnsCount = this.renderedItems - 1;
}
lastRowTop = movieElem.getBoundingClientRect().top;
if (!isScrolledIntoView(movieElem) && !this.maxRenderCount) {
if (!isScrolledIntoView(movieElem) && !this.maxRenderCount && this.renderedItems > 0) {
this.maxRenderCount = this.renderedItems - 1 + this.columnsCount * loadAdditionalRowsCount;
console.log(`Set max render this.renderedItems to ${this.maxRenderCount}`);
}
}
} else {

Loading…
Cancel
Save