Fix: Edge case where navigating through 2 different loaded panels caused incorrect width on posters

pull/30/head 2.0.8
Juraj Nyíri 3 years ago
parent 4aab554872
commit 824f993694

@ -20734,6 +20734,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.runBefore = ''; this.runBefore = '';
this.playTrailer = true; this.playTrailer = true;
this.showExtras = true; this.showExtras = true;
this.isVisible = true;
this.showSearch = true; this.showSearch = true;
this.previousPageWidth = 0; this.previousPageWidth = 0;
this.runAfter = ''; this.runAfter = '';
@ -20768,6 +20769,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
}; };
this.loadInitialData = async () => { this.loadInitialData = async () => {
this.initialDataLoaded = true;
setInterval(() => {
const isVisibleNow = !lodash.isNull(this.offsetParent);
if (isVisibleNow && !this.isVisible) {
this.renderPage();
}
this.isVisible = isVisibleNow;
}, 100);
if (this.hassObj) { if (this.hassObj) {
this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection); this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection);
} }
@ -20834,7 +20843,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.previousPageWidth = this.card.offsetWidth; this.previousPageWidth = this.card.offsetWidth;
} }
this.resizeBackground(); this.resizeBackground();
this.initialDataLoaded = true;
}; };
this.renderInitialData = async () => { this.renderInitialData = async () => {
let { entity } = JSON.parse(JSON.stringify(this.config)); let { entity } = JSON.parse(JSON.stringify(this.config));

@ -45,6 +45,8 @@ class PlexMeetsHomeAssistant extends HTMLElement {
showExtras = true; showExtras = true;
isVisible = true;
showSearch = true; showSearch = true;
previousPageWidth = 0; previousPageWidth = 0;
@ -159,6 +161,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
}; };
loadInitialData = async (): Promise<void> => { loadInitialData = async (): Promise<void> => {
this.initialDataLoaded = true;
setInterval(() => {
const isVisibleNow = !_.isNull(this.offsetParent);
if (isVisibleNow && !this.isVisible) {
this.renderPage();
}
this.isVisible = isVisibleNow;
}, 100);
if (this.hassObj) { if (this.hassObj) {
this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection); this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection);
} }
@ -228,7 +238,6 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.previousPageWidth = this.card.offsetWidth; this.previousPageWidth = this.card.offsetWidth;
} }
this.resizeBackground(); this.resizeBackground();
this.initialDataLoaded = true;
}; };
renderInitialData = async (): Promise<void> => { renderInitialData = async (): Promise<void> => {

Loading…
Cancel
Save