mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 20:21:43 +08:00
attribute sync should trigger note reload, fixes #551
This commit is contained in:
parent
237749e4af
commit
d08a36174d
2 changed files with 19 additions and 4 deletions
|
@ -337,10 +337,18 @@ function fireDetailLoaded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
messagingService.subscribeToSyncMessages(syncData => {
|
messagingService.subscribeToSyncMessages(syncData => {
|
||||||
for (const sync of syncData) {
|
const noteIdsToRefresh = new Set();
|
||||||
if (sync.entityName === 'notes') {
|
|
||||||
refreshTabs(null, sync.entityId);
|
syncData
|
||||||
}
|
.filter(sync => sync.entityName === 'notes')
|
||||||
|
.forEach(sync => noteIdsToRefresh.add(sync.entityId));
|
||||||
|
|
||||||
|
syncData
|
||||||
|
.filter(sync => sync.entityName === 'attributes')
|
||||||
|
.forEach(sync => noteIdsToRefresh.add(sync.noteId));
|
||||||
|
|
||||||
|
for (const noteId of noteIdsToRefresh) {
|
||||||
|
refreshTabs(null, noteId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,13 @@ async function sendMessageToAllClients(message) {
|
||||||
|
|
||||||
async function sendPing(client, lastSentSyncId) {
|
async function sendPing(client, lastSentSyncId) {
|
||||||
const syncData = await sql.getRows("SELECT * FROM sync WHERE id > ?", [lastSentSyncId]);
|
const syncData = await sql.getRows("SELECT * FROM sync WHERE id > ?", [lastSentSyncId]);
|
||||||
|
|
||||||
|
for (const sync of syncData) {
|
||||||
|
if (sync.entityName === 'attributes') {
|
||||||
|
sync.noteId = await sql.getValue(`SELECT noteId FROM attributes WHERE attributeId = ?`, [sync.entityId]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const stats = require('./sync').stats;
|
const stats = require('./sync').stats;
|
||||||
|
|
||||||
await sendMessage(client, {
|
await sendMessage(client, {
|
||||||
|
|
Loading…
Reference in a new issue