From bd718796c52a1b3ba60cc6c6545d54b2e5d74c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Fri, 16 Oct 2026 16:42:03 -0300 Subject: [PATCH] fix: an image still being read after leaving the product page no longer throws "Voltar" closes the product page but leaves the artwork list; an image whose reading finished afterwards repainted it with no product chosen and threw (MODOS[null].larg). It now paints nothing. The artwork browser test caught it now and then, failing CI. Co-Authored-By: Claude Opus 5.5 --- web/site-pdf.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/site-pdf.js b/web/site-pdf.js index 042bf62..49ace99 100644 --- a/web/site-pdf.js +++ b/web/site-pdf.js @@ -406,6 +406,7 @@ function detalhesDaFolha(a,i,aberto){ linhas.map(l=>''+l+'').join('')+''; } function pintaFolha(){ + if(!MODOS[modo]) return; // read after the customer left the product page invalidaItemAtual(); const L=larguraFilme(); pintaTipoEnvio(); // trava o seletor enquanto houver folha @@ -529,6 +530,9 @@ function pintaProgressoArte(a){ barra.style.width=a.lendo+'%'; if(texto) texto.textContent='arquivo grande · gerando a prévia · '+faltaLeitura(a.leitura); } function pintaArtes(){ + // A file still being read when the customer left the product page lands + // here with no product open: nothing to paint. + if(!MODOS[modo]) return; invalidaItemAtual(); $('zona').classList.toggle('compacta', artes.length>0); // The same card as a finished sheet: thumbnail, size, a DPI chip, then the