Attachments box: Don't set this._item to non-regular item

Fixes occasional errors due to `getAttachments()` being called on a
non-regular item in `updateCount()`.
This commit is contained in:
Abe Jellinek 2024-01-18 16:43:31 -05:00 committed by Dan Stillman
parent c208325aeb
commit f468245caf

View file

@ -54,14 +54,11 @@
set item(item) {
let isRegularItem = item?.isRegularItem();
this.hidden = !isRegularItem;
if (this._item === item) {
if (!isRegularItem || this._item === item) {
return;
}
this._item = item;
if (!isRegularItem) {
return;
}
this.refresh();
}
@ -184,6 +181,8 @@
}
async refresh() {
if (!this._item) return;
this.usePreview = Zotero.Prefs.get('showAttachmentPreview');
await this._updateAttachmentIDs();