From d8d46ae08447043f178e6460a5079579ace0406f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 24 May 2024 19:36:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20background=20page=20reset?= =?UTF-8?q?=20on=20background=20removal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression of ef51c792b3637cb93752dc841f22d16373bb4bf9 --- src/assets/cardfoldr.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/assets/cardfoldr.js b/src/assets/cardfoldr.js index 914c56a..f177304 100644 --- a/src/assets/cardfoldr.js +++ b/src/assets/cardfoldr.js @@ -333,15 +333,19 @@ const refreshPdf = async (changed) => { const jobs = []; - if (changed.includes("pdf") && pdf) { + if (changed.includes("pdf")) { clearPages(pagesContainer); - jobs.push(renderPages(pdf, pagesContainer, "page", "Page ", pageSelection)); + if (pdf) { + jobs.push(renderPages(pdf, pagesContainer, "page", "Page ", pageSelection)); + } } - if (changed.includes("background") && backgroundPdf) { + if (changed.includes("background")) { const backgroundPagesContainer = document.getElementById('pages-back'); clearPages(backgroundPagesContainer); - jobs.push(renderPages(backgroundPdf, backgroundPagesContainer, "background-page", "Backs page ", backgroundPageSelection)); + if (backgroundPdf) { + jobs.push(renderPages(backgroundPdf, backgroundPagesContainer, "background-page", "Backs page ", backgroundPageSelection)); + } } await Promise.all(jobs);