- add document evidence parsing/search/open routes, Hermes tool wiring, local index settings/status, and the document-evidence skill plus design notes - fix PDF resource tabs by rendering PDFs inline with pdf.js canvases instead of iframe preview pages, release PDF documents on close, and document the fourth-PDF stall bug - keep PDF preview at 2x rendering while removing the previous lazy-load/placeholder direction, and make dev:hot bind loopback defaults externally reachable Verification: - node --check rust/crates/mnote-web/browser/document-resource-tab-runtime.js - node scripts/task-dev-hot-plan-test.js - cargo test -p mnote-web --manifest-path rust/Cargo.toml pdf_preview_page_does_not_render_visible_toolbar - cargo test -p mnote-web --manifest-path rust/Cargo.toml document_shell_returns_page_aggregate_snapshot - cargo build -p mnote-web --manifest-path rust/Cargo.toml - browser smoke: sequentially opened the four tea_seed_oil_cosmetic PDFs; fourth PDF rendered 15/15 canvases, iframeCount=0, browser errors=0
1.8 KiB
1.8 KiB
PDF resource tab 连续打开第 4 个文件卡住
现象
- 在文档页 resource tab 内连续打开多个 PDF 时,第 4 个 PDF 必现卡住。
- 卡住时 tab 标题已经切换,但 iframe 仍停在
about:blank或空 body,PDF canvas 数量为 0。 - 单独打开
/pdf-preview页面、或独立页面中复用单个 iframe 连续切换 PDF,均不能复现。
根因
PDF resource tab 通过 iframe 加载 /pdf-preview,连续创建/替换 PDF iframe 后会进入空白加载状态。问题不在具体 PDF 文件,也不在页数懒加载策略。
修复
- resource tab 内的 PDF 改为直接使用 pdf.js 渲染 canvas,不再通过 iframe 打开
/pdf-preview。 - 关闭或替换 PDF resource tab 时销毁 pdf.js document,释放渲染资源。
- 移除
/pdf-preview内此前排查用的懒加载、占位页和多页预渲染逻辑,保留 2x 起步渲染清晰度。 dev:hot默认把 loopback bind 修正为0.0.0.0:<port>,避免外网访问不到 3000。
验证
- 真实浏览器连续打开以下 4 个 PDF:
patent/WO2024170760A1_Camellia_oleifera_tea_oil_concentrate.pdfstandard/T_CAIFCCI_106-2026_cosmetic_ingredient_camellia_oleifera_seed_oil.pdfliterature/Ouyang_2024_Frontiers_aged_Camellia_oleifera_oil_AD.pdfliterature/Leclere_2025_OCL_Tea_oil_concentrate.pdf
- 第 4 个 PDF 结果:
canvasCount=15,iframeCount=0,status=15 / 15,浏览器错误 0。 node --check rust/crates/mnote-web/browser/document-resource-tab-runtime.jsnode scripts/task-dev-hot-plan-test.jscargo test -p mnote-web --manifest-path rust/Cargo.toml pdf_preview_page_does_not_render_visible_toolbarcargo test -p mnote-web --manifest-path rust/Cargo.toml document_shell_returns_page_aggregate_snapshotcargo build -p mnote-web --manifest-path rust/Cargo.toml