similar notes is getting updated automatically after the title change

This commit is contained in:
zadam
2019-09-03 21:31:39 +02:00
parent 9404e27cba
commit 2e05cb1764
10 changed files with 53 additions and 30 deletions
@@ -267,9 +267,11 @@ class Attributes {
}
}
syncDataReceived(syncData) {
if (syncData.find(sd => sd.entityName === 'attributes' && sd.noteId === this.ctx.note.noteId)) {
this.reloadAttributes();
eventReceived(name, data) {
if (name === 'syncData') {
if (data.find(sd => sd.entityName === 'attributes' && sd.noteId === this.ctx.note.noteId)) {
this.reloadAttributes();
}
}
}
}
@@ -374,7 +374,7 @@ ws.subscribeToOutsideSyncMessages(syncData => {
ws.subscribeToAllSyncMessages(syncData => {
for (const tc of tabContexts) {
tc.syncDataReceived(syncData);
tc.eventReceived('syncData', syncData);
}
});
+3 -3
View File
@@ -106,10 +106,10 @@ class Sidebar {
}
}
syncDataReceived(syncData) {
eventReceived(name, data) {
for (const widget of this.widgets) {
if (widget.syncDataReceived) {
widget.syncDataReceived(syncData);
if (widget.eventReceived) {
widget.eventReceived(name, data);
}
}
}
@@ -267,6 +267,8 @@ class TabContext {
// run async
bundleService.executeRelationBundles(this.note, 'runOnNoteChange', this);
this.eventReceived('noteSaved');
}
async saveNoteIfChanged() {
@@ -366,11 +368,11 @@ class TabContext {
}
}
syncDataReceived(syncData) {
this.attributes.syncDataReceived(syncData);
eventReceived(name, data) {
this.attributes.eventReceived(name, data);
if (this.sidebar) {
this.sidebar.syncDataReceived(syncData);
this.sidebar.eventReceived(name, data);
}
}