From 366c90f71d194d4d0b82ccd1de08f070147fbb2b Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sat, 29 Jan 2022 17:10:47 +0200 Subject: [PATCH] fix showing old lyrics if new lyrics couldn't be resolved --- plugins/lyrics-genius/front.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/plugins/lyrics-genius/front.js b/plugins/lyrics-genius/front.js index 8a1802e4..e7d288e0 100644 --- a/plugins/lyrics-genius/front.js +++ b/plugins/lyrics-genius/front.js @@ -15,13 +15,22 @@ module.exports = () => { return; } + let hasLyrics = true; + const html = ipcRenderer.sendSync( "search-genius-lyrics", extractedSongInfo ); if (!html) { + // Delete previous lyrics if tab is open and couldn't get new lyrics + checkLyricsContainer(() => { + hasLyrics = false; + setTabsOnclick(undefined); + }); return; - } else if (is.dev()) { + } + + if (is.dev()) { console.log("Fetched lyrics from Genius"); } @@ -42,11 +51,7 @@ module.exports = () => { enableLyricsTab(); - for (tab of [tabs.upNext, tabs.discover]) { - if (tab) { - tab.onclick = enableLyricsTab; - } - } + setTabsOnclick(enableLyricsTab); checkLyricsContainer(); @@ -74,12 +79,22 @@ module.exports = () => { function setLyrics(lyricsContainer) { lyricsContainer.innerHTML = `