mirror of
https://github.com/zotero/zotero.git
synced 2026-10-05 02:43:38 +00:00
Clear undo history if applying an undo/redo entry fails
A failed save means the object no longer matches the captured snapshot, so the remaining entries can't be trusted either. Clear both stacks instead of dropping just the failed entry.
This commit is contained in:
parent
c30908db8c
commit
7a7d0bb587
1 changed files with 8 additions and 2 deletions
|
|
@ -168,7 +168,10 @@ Zotero.UndoHistory = {
|
|||
}
|
||||
catch (e) {
|
||||
Zotero.logError('UndoHistory: undo failed: ' + e);
|
||||
// Entry is lost -- don't push to redo
|
||||
// A failure means the object drifted out from under our snapshots,
|
||||
// so the rest of the stack can't be trusted either. Discard history
|
||||
// rather than risk applying stale values.
|
||||
this.clear();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
@ -202,7 +205,10 @@ Zotero.UndoHistory = {
|
|||
}
|
||||
catch (e) {
|
||||
Zotero.logError('UndoHistory: redo failed: ' + e);
|
||||
// Entry is lost -- don't push to undo
|
||||
// A failure means the object drifted out from under our snapshots,
|
||||
// so the rest of the stack can't be trusted either. Discard history
|
||||
// rather than risk applying stale values.
|
||||
this.clear();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue