fix(pdf): guard against null textLayerEl in renderPage
Prevents 'can't access property innerHTML, textDiv is null' when the component unmounts while a render is in flight (e.g. switching to OCR progress view tears down the panel content). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,7 @@ async function renderPage(doc: PDFDocumentProxy, pageNum: number) {
|
||||
|
||||
// Text layer
|
||||
const textDiv = textLayerEl;
|
||||
if (!textDiv) return;
|
||||
textDiv.innerHTML = '';
|
||||
textDiv.style.width = `${viewport.width / dpr}px`;
|
||||
textDiv.style.height = `${viewport.height / dpr}px`;
|
||||
|
||||
Reference in New Issue
Block a user