From c29c377c92a7498dcaff3ae42e534af606438a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Wed, 14 Jul 2021 00:03:42 +0200 Subject: [PATCH] Fix: Bug where if searched used and one poster returned it was no longer possible to get more than 1 poster on page --- dist/plex-meets-homeassistant.js | 12 +++++++----- src/plex-meets-homeassistant.ts | 14 ++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 1288fb5..268de10 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -21088,10 +21088,12 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.searchInputElem.value = this.searchValue; this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`; this.searchInputElem.addEventListener('keyup', () => { - this.searchValue = this.searchInputElem.value; - this.renderPage(); - this.focus(); - this.renderNewElementsIfNeeded(); + if (!lodash.isEqual(this.searchInputElem.value, this.searchValue)) { + this.searchValue = this.searchInputElem.value; + this.renderPage(); + this.focus(); + this.renderNewElementsIfNeeded(); + } }); searchContainer.appendChild(this.searchInputElem); return searchContainer; @@ -21182,7 +21184,7 @@ class PlexMeetsHomeAssistant extends HTMLElement { } } this.renderedItems = 0; - this.columnsCount = 0; + // this.columnsCount = 0; const spinner = document.createElement('div'); spinner.style.display = 'flex'; spinner.style.alignItems = 'center'; diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index f47c288..02fce57 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -154,7 +154,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.renderedItems > 0 ) { this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2); - this.renderMovieElems(); this.calculatePositions(); } @@ -452,10 +451,12 @@ class PlexMeetsHomeAssistant extends HTMLElement { this.searchInputElem.placeholder = `Search ${this.config.libraryName}...`; this.searchInputElem.addEventListener('keyup', () => { - this.searchValue = this.searchInputElem.value; - this.renderPage(); - this.focus(); - this.renderNewElementsIfNeeded(); + if (!_.isEqual(this.searchInputElem.value, this.searchValue)) { + this.searchValue = this.searchInputElem.value; + this.renderPage(); + this.focus(); + this.renderNewElementsIfNeeded(); + } }); searchContainer.appendChild(this.searchInputElem); @@ -557,7 +558,8 @@ class PlexMeetsHomeAssistant extends HTMLElement { } this.renderedItems = 0; - this.columnsCount = 0; + // this.columnsCount = 0; + const spinner = document.createElement('div'); spinner.style.display = 'flex'; spinner.style.alignItems = 'center';