From e2b72944bea4585e52ea029547dc416292b9138a Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:12:32 +0800 Subject: [PATCH] Fix attachments section not updated when attachments are changed (#3992) fix: #3989 --- chrome/content/zotero/elements/attachmentsBox.js | 3 +++ chrome/content/zotero/elements/itemPaneSection.js | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/elements/attachmentsBox.js b/chrome/content/zotero/elements/attachmentsBox.js index 478c017a8d..82da8df629 100644 --- a/chrome/content/zotero/elements/attachmentsBox.js +++ b/chrome/content/zotero/elements/attachmentsBox.js @@ -96,6 +96,9 @@ } notify(action, type, ids) { + if (ids.includes(this._item?.id)) { + this._resetRenderedFlags(); + } if (!this._item?.isRegularItem()) return; this._updateAttachmentIDs().then(() => { diff --git a/chrome/content/zotero/elements/itemPaneSection.js b/chrome/content/zotero/elements/itemPaneSection.js index b9548c25d1..a8e8d14847 100644 --- a/chrome/content/zotero/elements/itemPaneSection.js +++ b/chrome/content/zotero/elements/itemPaneSection.js @@ -95,11 +95,15 @@ class ItemPaneSectionElementBase extends XULElementBase { return false; } - async _forceRenderAll() { - if (this.hidden) return; + _resetRenderedFlags() { // Clear cached flags to allow re-rendering delete this._syncRenderItemID; delete this._asyncRenderItemID; + } + + async _forceRenderAll() { + if (this.hidden) return; + this._resetRenderedFlags(); if (this.render) this.render(); if (this.asyncRender) await this.asyncRender(); }