mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
autocomplete cache gets updated with note update
This commit is contained in:
@@ -5,6 +5,12 @@ const syncSetup = require('./sync_setup');
|
||||
const log = require('./log');
|
||||
const cls = require('./cls');
|
||||
|
||||
const listeners = [];
|
||||
|
||||
function addListener(listener) {
|
||||
listeners.push(listener);
|
||||
}
|
||||
|
||||
async function addNoteSync(noteId, sourceId) {
|
||||
await addEntitySync("notes", noteId, sourceId)
|
||||
}
|
||||
@@ -58,6 +64,11 @@ async function addEntitySync(entityName, entityId, sourceId) {
|
||||
// useful when you fork the DB for new "client" instance, it won't try to sync the whole DB
|
||||
await sql.execute("UPDATE options SET value = (SELECT MAX(id) FROM sync) WHERE name IN('lastSyncedPush', 'lastSyncedPull')");
|
||||
}
|
||||
|
||||
for (const listener of listeners) {
|
||||
// not awaiting to not block the execution
|
||||
listener(entityName, entityId);
|
||||
}
|
||||
}
|
||||
|
||||
async function cleanupSyncRowsForMissingEntities(entityName, entityKey) {
|
||||
@@ -104,6 +115,7 @@ async function fillAllSyncRows() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
addListener,
|
||||
addNoteSync,
|
||||
addBranchSync,
|
||||
addNoteReorderingSync,
|
||||
|
||||
Reference in New Issue
Block a user