mirror of
https://github.com/zotero/zotero.git
synced 2026-10-10 03:28:10 +00:00
tagsbox: fix deleted tags reappearing (#5533)
https://forums.zotero.org/discussion/110655/z7-beta-tags-reappear-after-quickly-deleting-them If a library has many tags and one quickly clicks on "-" button to deleted multiple tags from an item, the database updates may not keep up with UI. To address this, save item only once after a debounce. Fixes: #5410
This commit is contained in:
parent
035a03fdf2
commit
c339d52ec3
1 changed files with 9 additions and 1 deletions
|
|
@ -238,7 +238,11 @@
|
|||
this.remove(tagName);
|
||||
try {
|
||||
item.removeTag(tagName);
|
||||
await item.saveTx();
|
||||
// Save item after a debounce to avoid triggering multiple
|
||||
// save operations. If there are many tags in the library,
|
||||
// db transaction may not keep up with UI changes, and cause
|
||||
// some deleted rows to reappear.
|
||||
this._saveItemDebounced(item);
|
||||
}
|
||||
catch (e) {
|
||||
this._forceRenderAll();
|
||||
|
|
@ -609,6 +613,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
_saveItemDebounced = Zotero.Utilities.debounce(async (item) => {
|
||||
await item.saveTx();
|
||||
});
|
||||
|
||||
_id(id) {
|
||||
return this.querySelector(`[id=${id}]`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue