mirror of
https://github.com/zadam/trilium.git
synced 2024-11-11 01:23:57 +08:00
froca should not keep any deleted notes
This commit is contained in:
parent
d8d15b528e
commit
5d58520949
4 changed files with 12 additions and 5 deletions
|
@ -61,8 +61,6 @@ class NoteShort {
|
|||
this.type = row.type;
|
||||
/** @param {string} content-type, e.g. "application/json" */
|
||||
this.mime = row.mime;
|
||||
/** @param {boolean} */
|
||||
this.isDeleted = !!row.isDeleted;
|
||||
}
|
||||
|
||||
addParent(parentNoteId, branchId) {
|
||||
|
|
|
@ -72,7 +72,7 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
|
|||
if (logErrors) {
|
||||
const parent = froca.getNoteFromCache(parentNoteId);
|
||||
|
||||
console.log(utils.now(), `Did not find parent ${parentNoteId} (${parent ? parent.title : 'n/a'}) for child ${childNoteId} (${child.title}), available parents: ${parents.map(p => `${p.noteId} (${p.title})`)}`);
|
||||
console.debug(utils.now(), `Did not find parent ${parentNoteId} (${parent ? parent.title : 'n/a'}) for child ${childNoteId} (${child.title}), available parents: ${parents.map(p => `${p.noteId} (${p.title})`)}. You can ignore this message as it is mostly harmless.`);
|
||||
}
|
||||
|
||||
const someNotePath = getSomeNotePath(child, hoistedNoteId);
|
||||
|
|
|
@ -219,8 +219,13 @@ async function processEntityChanges(entityChanges) {
|
|||
const note = froca.notes[ec.entityId];
|
||||
|
||||
if (note) {
|
||||
note.update(ec.entity);
|
||||
loadResults.addNote(ec.entityId, ec.sourceId);
|
||||
if (ec.entity.isDeleted) {
|
||||
delete froca.notes[ec.entityId];
|
||||
}
|
||||
else {
|
||||
note.update(ec.entity);
|
||||
loadResults.addNote(ec.entityId, ec.sourceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,10 @@ function sendMessageToAllClients(message) {
|
|||
}
|
||||
|
||||
function fillInAdditionalProperties(entityChange) {
|
||||
// most of these could be filled by becca
|
||||
// the exception is isDeleted - in that case becca doesn't contain such entity at all
|
||||
// this would have to be handled separately
|
||||
|
||||
// fill in some extra data needed by the frontend
|
||||
if (entityChange.entityName === 'attributes') {
|
||||
entityChange.entity = sql.getRow(`SELECT * FROM attributes WHERE attributeId = ?`, [entityChange.entityId]);
|
||||
|
|
Loading…
Reference in a new issue