From 1d40268c9f0b5fcf51cfc6e5f6037d44adf5c77c Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sat, 31 Oct 2026 23:24:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=97=E4=BD=93=E6=A1=86=E5=8F=8A=E4=BE=A7?= =?UTF-8?q?=E6=A0=8F=E5=88=B7=E6=96=B0=E9=97=AA=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index 110bfcc..0f06810 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -5704,11 +5704,17 @@ async function refreshEditorPage(doc, index, openSeq, clearSelection = false) { const search = refreshSearchPages([index], openSeq); state.documentSelection = null; pageView.resetPageLoading(); + let details; try { - const page = await pageView.loadPageData(index, { openSeq, priority: 0, refresh: true }); + const [page, prepared] = await Promise.all([ + pageView.loadPageData(index, { openSeq, priority: 0, refresh: true }), + callWASM("ofdgoDocumentInfo").catch(err => ({ detailsError: err.message })), + ]); if (openSeq !== state.openSeq) { return; } + details = prepared.detailsError ? null : prepared; + Object.assign(doc, { detailsPending: false, detailsError: "" }, prepared); if (clearSelection) { const pending = canvasEditor.pendingSelection; canvasEditor.clear(); @@ -5737,7 +5743,7 @@ async function refreshEditorPage(doc, index, openSeq, clearSelection = false) { pageView.releasePageResources(); renderMeta(true); updateControls(); - loadDocumentDetails(openSeq); + loadDocumentDetails(openSeq, details); await search; for (const shell of el.svgHost.children) pageView.observeFlowPage(shell); for (const button of el.pageList.children) pageView.observeThumbnail(button, Number(button.dataset.pageIndex), openSeq); @@ -7317,13 +7323,13 @@ function completePDF(tab) { return task.promise; } -async function loadDocumentDetails(openSeq) { +async function loadDocumentDetails(openSeq, details) { const tab = documentTab(), state = tab.state; const callWASM = (name, ...args) => callTabWASM(tab, name, ...args); if (openSeq !== state.openSeq || !state.doc) return; if (state.sourcePDF && !state.pdfComplete && !state.editorInfo) { completePDF(tab); return; } try { - const details = await callWASM("ofdgoDocumentInfo"); + details ||= await callWASM("ofdgoDocumentInfo"); if (openSeq !== state.openSeq) return; Object.assign(state.doc, details, { detailsPending: false, detailsError: "" }); renderMeta();