Fix: Performance issue when maxCount and useHorizontalScroll used together

pull/72/head
Juraj Nyíri 3 years ago
parent 943c4ee339
commit 762b45b407

@ -21984,6 +21984,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 && window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 &&
this.renderedItems > 0 && this.renderedItems > 0 &&
this.renderedItems < this.data[this.config.libraryName].length && this.renderedItems < this.data[this.config.libraryName].length &&
(!this.maxCount || this.renderedItems < this.maxCount) &&
(!this.maxRows || this.renderedRows < this.config.maxRows)) { (!this.maxRows || this.renderedRows < this.config.maxRows)) {
this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2); this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems(); this.renderMovieElems();
@ -22381,14 +22382,12 @@ class PlexMeetsHomeAssistant extends HTMLElement {
renderMore) { renderMore) {
let count = 0; let count = 0;
let maxRenderedItems = this.data[this.config.libraryName].length; let maxRenderedItems = this.data[this.config.libraryName].length;
let itemsPerRow = this.data[this.config.libraryName].length; this.data[this.config.libraryName].length;
if (this.maxCount) { if (this.maxCount) {
maxRenderedItems = this.maxCount; maxRenderedItems = this.maxCount;
itemsPerRow = maxRenderedItems;
if (this.maxRows) { if (this.maxRows) {
itemsPerRow = Math.round(maxRenderedItems / this.maxRows); Math.round(maxRenderedItems / this.maxRows);
} }
console.log(itemsPerRow);
} }
// eslint-disable-next-line consistent-return // eslint-disable-next-line consistent-return
const searchValues = lodash.split(this.searchValue, ' '); const searchValues = lodash.split(this.searchValue, ' ');

@ -191,6 +191,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 && window.innerHeight + window.scrollY > height + getOffset(this.content).top - 300 &&
this.renderedItems > 0 && this.renderedItems > 0 &&
this.renderedItems < this.data[this.config.libraryName].length && this.renderedItems < this.data[this.config.libraryName].length &&
(!this.maxCount || this.renderedItems < this.maxCount) &&
(!this.maxRows || this.renderedRows < this.config.maxRows) (!this.maxRows || this.renderedRows < this.config.maxRows)
) { ) {
this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2); this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2);
@ -618,7 +619,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (this.maxRows) { if (this.maxRows) {
itemsPerRow = Math.round(maxRenderedItems / this.maxRows); itemsPerRow = Math.round(maxRenderedItems / this.maxRows);
} }
console.log(itemsPerRow);
} }
// eslint-disable-next-line consistent-return // eslint-disable-next-line consistent-return
const searchValues = _.split(this.searchValue, ' '); const searchValues = _.split(this.searchValue, ' ');

Loading…
Cancel
Save