From e01e6ef9f5fb126a9130ab6ea46bc2c1aed84d71 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Wed, 19 Aug 2026 09:55:28 +0300 Subject: [PATCH] Fix annotations not appearing when imported while reader is opening Fixes https://forums.zotero.org/discussion/133270/bug-embedded-pdf-annotations-and-highlights-fail-to-render-in-zotero-reader (cherry picked from commit db1216d3e2a1f680279942c029800afa1899c910) --- chrome/content/zotero/xpcom/reader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 89e4bc7e6c..603c27b7b9 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -740,11 +740,15 @@ class ReaderInstance { } } if (annotations.length) { + // Annotations can be added before the reader finishes initializing -- e.g., when + // embedded annotations are imported right after opening a newly added file + await this._initPromise; this._internalReader.setAnnotations(Components.utils.cloneInto(annotations, this._iframeWindow)); } } - unsetAnnotations(keys) { + async unsetAnnotations(keys) { + await this._initPromise; this._internalReader.unsetAnnotations(Components.utils.cloneInto(keys, this._iframeWindow)); }