mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:23:10 +00:00
Clear PDF file container element before rendering (#16028)
GitOrigin-RevId: acec635bc1bbd47bf76f6a15151fefc0831fa541
This commit is contained in:
parent
18ad44c278
commit
2f45c8b90a
1 changed files with 8 additions and 0 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Reference in a new issue