Skip to content

Build your personal knowledge base with Trilium Notes

froca should not keep any deleted notes

zadam5d585209498c
diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js
index 03f39f630a..1fa8153448 100644
--- a/src/public/app/entities/note_short.js
+++ b/src/public/app/entities/note_short.js
@@ -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) {
diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.js
index f8d03e4dbc..c87798f8b7 100644
--- a/src/public/app/services/tree.js
+++ b/src/public/app/services/tree.js
@@ -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);
diff --git a/src/public/app/services/ws.js b/src/public/app/services/ws.js
index bec71d677a..d94236036a 100644
--- a/src/public/app/services/ws.js
+++ b/src/public/app/services/ws.js
@@ -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);
+ }
}
}
diff --git a/src/services/ws.js b/src/services/ws.js
index 0fbddf4bdd..15c4cb7504 100644
--- a/src/services/ws.js
+++ b/src/services/ws.js
@@ -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]);