Fix: Resize removing everything and not rerendering

pull/72/head
Juraj Nyíri 3 years ago
parent 11c9f43103
commit 5aae117116

@ -21978,6 +21978,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.contentBGHeight = 0; this.contentBGHeight = 0;
this.initialDataLoaded = false; this.initialDataLoaded = false;
this.renderNewElementsIfNeeded = () => { this.renderNewElementsIfNeeded = () => {
console.log('renderNewElementsIfNeeded');
const loadAdditionalRowsCount = 2; // todo: make this configurable const loadAdditionalRowsCount = 2; // todo: make this configurable
const height = getHeight(this.content); const height = getHeight(this.content);
if (!this.detailsShown && if (!this.detailsShown &&
@ -22497,6 +22498,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
} }
this.renderedItems = 0; this.renderedItems = 0;
this.renderedRows = 0;
// this.columnsCount = 0; // this.columnsCount = 0;
const spinner = document.createElement('div'); const spinner = document.createElement('div');
spinner.style.display = 'flex'; spinner.style.display = 'flex';
@ -22746,7 +22748,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
break; break;
} }
else { else {
this.resizeHandler();
clearInterval(setLeftOffsetsInterval); clearInterval(setLeftOffsetsInterval);
} }
} }

@ -184,6 +184,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
renderNewElementsIfNeeded = (): void => { renderNewElementsIfNeeded = (): void => {
console.log('renderNewElementsIfNeeded');
const loadAdditionalRowsCount = 2; // todo: make this configurable const loadAdditionalRowsCount = 2; // todo: make this configurable
const height = getHeight(this.content); const height = getHeight(this.content);
if ( if (
@ -273,7 +274,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
} }
} }
this.renderNewElementsIfNeeded(); this.renderNewElementsIfNeeded();
}); });
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
@ -735,6 +735,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
this.renderedItems = 0; this.renderedItems = 0;
this.renderedRows = 0;
// this.columnsCount = 0; // this.columnsCount = 0;
const spinner = document.createElement('div'); const spinner = document.createElement('div');
@ -1009,11 +1010,11 @@ class PlexMeetsHomeAssistant extends HTMLElement {
// todo: figure out why interval is needed here and do it properly // todo: figure out why interval is needed here and do it properly
const setLeftOffsetsInterval = setInterval(() => { const setLeftOffsetsInterval = setInterval(() => {
this.movieElems = this.getElementsByClassName('movieElem'); this.movieElems = this.getElementsByClassName('movieElem');
for (let i = 0; i < this.movieElems.length; i += 1) { for (let i = 0; i < this.movieElems.length; i += 1) {
if (this.movieElems[i].offsetLeft === 0) { if (this.movieElems[i].offsetLeft === 0) {
break; break;
} else { } else {
this.resizeHandler();
clearInterval(setLeftOffsetsInterval); clearInterval(setLeftOffsetsInterval);
} }
} }

Loading…
Cancel
Save