Skip to content

Build your personal knowledge base with Trilium Notes

frontend sync fixes

zadam99ea238c3ffd
diff --git a/src/public/javascripts/services/ws.js b/src/public/javascripts/services/ws.js
index c2ba50234a..714c9eaa1b 100644
--- a/src/public/javascripts/services/ws.js
+++ b/src/public/javascripts/services/ws.js
@@ -201,7 +201,7 @@ subscribeToMessages(message => {
});
async function processSyncRows(syncRows) {
- const loadResults = new LoadResults(this);
+ const loadResults = new LoadResults(treeCache);
syncRows.filter(sync => sync.entityName === 'notes').forEach(sync => {
const note = treeCache.notes[sync.entityId];
@@ -244,7 +244,7 @@ async function processSyncRows(syncRows) {
}
else if (!sync.entity.isDeleted) {
if (childNote || parentNote) {
- branch = new Branch(this, sync.entity);
+ branch = new Branch(treeCache, sync.entity);
treeCache.branches[branch.branchId] = branch;
loadResults.addBranch(sync.entityId, sync.sourceId);
@@ -294,7 +294,7 @@ async function processSyncRows(syncRows) {
}
else if (!sync.entity.isDeleted) {
if (sourceNote || targetNote) {
- attribute = new Attribute(this, sync.entity);
+ attribute = new Attribute(treeCache, sync.entity);
treeCache.attributes[attribute.attributeId] = attribute;
diff --git a/src/public/javascripts/widgets/note_tree.js b/src/public/javascripts/widgets/note_tree.js
index f0886b177c..23f2728647 100644
--- a/src/public/javascripts/widgets/note_tree.js
+++ b/src/public/javascripts/widgets/note_tree.js
@@ -404,7 +404,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
await this.tree.reload(notes);
}
- createTopLevelNoteListener() { treeService.createNewTopLevelNote(); }
+ createTopLevelNoteListener() { noteCreateService.createNewTopLevelNote(); }
collapseTreeListener() { this.collapseTree(); }
diff --git a/src/public/javascripts/widgets/tab_caching_widget.js b/src/public/javascripts/widgets/tab_caching_widget.js
index 3ab529f5a9..8914e8a989 100644
--- a/src/public/javascripts/widgets/tab_caching_widget.js
+++ b/src/public/javascripts/widgets/tab_caching_widget.js
@@ -45,7 +45,7 @@ export default class TabCachingWidget extends TabAwareWidget {
widget.eventReceived('setTabContext', {tabContext: this.tabContext});
}
- widget.toggle(true);
+ widget.toggle(widget.isEnabled());
}
tabRemovedListener({tabId}) {
@@ -63,7 +63,7 @@ export default class TabCachingWidget extends TabAwareWidget {
for (const tabId in this.widgets) {
this.widgets[tabId].toggle(
show
- && this.tabContext && tabId === this.tabContext.tabId
+ && this.isTab(tabId)
&& this.widgets[tabId].isEnabled());
}
}