Clear PDF file container element before rendering (#16028)

GitOrigin-RevId: acec635bc1bbd47bf76f6a15151fefc0831fa541
This commit is contained in:
Alf Eaton 2023-12-05 09:41:06 +00:00 committed by Copybot
parent 18ad44c278
commit 2f45c8b90a

View file

@ -35,6 +35,14 @@ const FileViewPdf: FC<{
const pdf = await PDFJS.getDocument(preview.url).promise
// bail out if loading the PDF took too long
if (!mountedRef.current) {
onError()
return
}
element.textContent = '' // ensure the element is empty
const scale = window.devicePixelRatio || 1
for (let i = 1; i <= pdf.numPages; i++) {