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:
parent
c208325aeb
commit
f468245caf
1 changed files with 3 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue