mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
recalculate maxEntityChangeId after rollbacked transaction
This commit is contained in:
parent
2e9dbda077
commit
a888f9aa04
@ -95,9 +95,9 @@ export default class RecentChangesDialog extends BasicWidget {
|
||||
|
||||
this.$widget.modal('hide');
|
||||
|
||||
setTimeout(() => {
|
||||
await ws.waitForMaxKnownEntityChangeId();
|
||||
|
||||
appContext.tabManager.getActiveContext().setNote(change.noteId);
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -136,6 +136,10 @@ function fillAllEntityChanges() {
|
||||
});
|
||||
}
|
||||
|
||||
function recalculateMaxEntityChangeId() {
|
||||
maxEntityChangeId = sql.getValue("SELECT COALESCE(MAX(id), 0) FROM entity_changes");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
addNoteReorderingEntityChange,
|
||||
moveEntityChangeToTop,
|
||||
@ -143,5 +147,6 @@ module.exports = {
|
||||
addEntityChangeWithInstanceId,
|
||||
fillAllEntityChanges,
|
||||
addEntityChangesForSector,
|
||||
getMaxEntityChangeId: () => maxEntityChangeId
|
||||
getMaxEntityChangeId: () => maxEntityChangeId,
|
||||
recalculateMaxEntityChangeId
|
||||
};
|
||||
|
@ -256,6 +256,9 @@ function transactional(func) {
|
||||
require('../becca/becca_loader').load();
|
||||
}
|
||||
|
||||
// the maxEntityChangeId has been incremented during failed transaction, need to recalculate
|
||||
require('./entity_changes').recalculateMaxEntityChangeId();
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user