diff --git a/docs/backend_api/ApiToken.html b/docs/backend_api/ApiToken.html index ba16476ba..5c512b555 100644 --- a/docs/backend_api/ApiToken.html +++ b/docs/backend_api/ApiToken.html @@ -28,7 +28,7 @@
-

ApiToken(apiTokenId, token, isDeleted, utcDateCreated)

+

ApiToken()

ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender.
@@ -45,7 +45,7 @@ -

new ApiToken(apiTokenId, token, isDeleted, utcDateCreated)

+

new ApiToken()

@@ -60,10 +60,15 @@ -
Parameters:
+ + + + +
Properties:
+ - +
@@ -180,8 +185,6 @@ - -
diff --git a/docs/backend_api/Attribute.html b/docs/backend_api/Attribute.html index a42ab9c37..8df31066f 100644 --- a/docs/backend_api/Attribute.html +++ b/docs/backend_api/Attribute.html @@ -28,7 +28,7 @@
-

Attribute(attributeId, noteId, type, name, value, position, isInheritable, isDeleted, utcDateCreated, utcDateModified)

+

Attribute()

Attribute is key value pair owned by a note.
@@ -45,7 +45,7 @@ -

new Attribute(attributeId, noteId, type, name, value, position, isInheritable, isDeleted, utcDateCreated, utcDateModified)

+

new Attribute()

@@ -60,10 +60,15 @@ -
Parameters:
+ + + + +
Properties:
+ -
+
@@ -318,8 +323,6 @@ - -
diff --git a/docs/backend_api/Branch.html b/docs/backend_api/Branch.html index bad86000e..dc7fe59aa 100644 --- a/docs/backend_api/Branch.html +++ b/docs/backend_api/Branch.html @@ -28,7 +28,7 @@
-

Branch(branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated)

+

Branch()

Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId. Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree.
@@ -46,7 +46,7 @@ Each note can have multiple (at least one) branches, meaning it can be placed in -

new Branch(branchId, noteId, parentNoteId, notePosition, prefix, isExpanded, isDeleted, utcDateModified, utcDateCreated)

+

new Branch()

@@ -61,10 +61,15 @@ Each note can have multiple (at least one) branches, meaning it can be placed in -
Parameters:
+ + + + +
Properties:
+ -
+
@@ -296,8 +301,6 @@ Each note can have multiple (at least one) branches, meaning it can be placed in - -
diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html index 5f8d01cc5..cfc3cb5e9 100644 --- a/docs/backend_api/Note.html +++ b/docs/backend_api/Note.html @@ -224,6 +224,29 @@ +
+ + + + + + + + + + + + + + + @@ -419,7 +442,7 @@
Source:
@@ -486,6 +509,112 @@ +

(async) getAllNotePaths() → {Promise.<Array.<Array.<string>>>}

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ - array of notePaths (each represented by array of noteIds constituting the particular note path) +
+ + + +
+
+ Type +
+
+ +Promise.<Array.<Array.<string>>> + + +
+
+ + + + + + + + + + + + +

(async) getAttribute(type, name) → {Promise.<Attribute>}

@@ -606,7 +735,7 @@
Source:
@@ -773,7 +902,7 @@
Source:
@@ -951,7 +1080,7 @@
Source:
@@ -1057,7 +1186,7 @@
Source:
@@ -1159,7 +1288,7 @@
Source:
@@ -1265,7 +1394,7 @@
Source:
@@ -1371,7 +1500,7 @@
Source:
@@ -1473,7 +1602,7 @@
Source:
@@ -1706,7 +1835,7 @@
Source:
@@ -1904,7 +2033,7 @@
Source:
@@ -2102,7 +2231,7 @@
Source:
@@ -2204,7 +2333,7 @@
Source:
@@ -2355,7 +2484,7 @@
Source:
@@ -2522,7 +2651,7 @@
Source:
@@ -2689,7 +2818,7 @@
Source:
@@ -2844,7 +2973,7 @@
Source:
@@ -2956,7 +3085,7 @@
Source:
@@ -3058,7 +3187,7 @@
Source:
@@ -3166,7 +3295,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -3274,7 +3403,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -3429,7 +3558,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -3596,7 +3725,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -3763,7 +3892,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -3918,7 +4047,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4088,7 +4217,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4239,7 +4368,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4349,7 +4478,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4451,7 +4580,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4557,7 +4686,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4735,7 +4864,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4841,7 +4970,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -4996,7 +5125,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -5151,7 +5280,7 @@ This method can be significantly faster than the getAttributes()
Source:
@@ -5262,7 +5391,7 @@ Cache is note instance scoped.
Source:
@@ -5346,7 +5475,7 @@ Cache is note instance scoped.
Source:
@@ -5452,7 +5581,7 @@ Cache is note instance scoped.
Source:
@@ -5558,7 +5687,7 @@ Cache is note instance scoped.
Source:
@@ -5664,7 +5793,7 @@ Cache is note instance scoped.
Source:
@@ -5770,7 +5899,7 @@ Cache is note instance scoped.
Source:
@@ -5876,7 +6005,7 @@ Cache is note instance scoped.
Source:
@@ -6105,7 +6234,7 @@ Cache is note instance scoped.
Source:
@@ -6303,7 +6432,7 @@ Cache is note instance scoped.
Source:
@@ -6501,7 +6630,7 @@ Cache is note instance scoped.
Source:
@@ -6730,7 +6859,7 @@ Cache is note instance scoped.
Source:
@@ -6832,7 +6961,7 @@ Cache is note instance scoped.
Source:
@@ -6934,7 +7063,7 @@ Cache is note instance scoped.
Source:
@@ -7132,7 +7261,7 @@ Cache is note instance scoped.
Source:
@@ -7330,7 +7459,7 @@ Cache is note instance scoped.
Source:
@@ -7590,7 +7719,7 @@ Cache is note instance scoped.
Source:
@@ -7819,7 +7948,7 @@ Cache is note instance scoped.
Source:
@@ -8048,7 +8177,7 @@ Cache is note instance scoped.
Source:
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html index 7143be4fb..232710773 100644 --- a/docs/backend_api/NoteRevision.html +++ b/docs/backend_api/NoteRevision.html @@ -28,7 +28,7 @@
-

NoteRevision(noteRevisionId, noteId, type, mime, title, isProtected, dateLastEdited, dateCreated, utcDateLastEdited, utcDateCreated, utcDateModified)

+

NoteRevision()

NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning.
@@ -45,7 +45,7 @@ -

new NoteRevision(noteRevisionId, noteId, type, mime, title, isProtected, dateLastEdited, dateCreated, utcDateLastEdited, utcDateCreated, utcDateModified)

+

new NoteRevision()

@@ -60,10 +60,15 @@ -
Parameters:
+ + + + +
Properties:
+ -
contentLength + + +int + + + + length of content
isProtected
+
@@ -193,6 +198,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -206,7 +257,7 @@
contentLength + + +int + + + +
isErased + + +boolean + + + +
-string +boolean @@ -341,8 +392,6 @@ - -
@@ -372,7 +421,7 @@
Source:
@@ -487,7 +536,7 @@
Source:
@@ -589,7 +638,7 @@
Source:
@@ -695,7 +744,7 @@
Source:
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html index 6a5164900..8bde36791 100644 --- a/docs/backend_api/Option.html +++ b/docs/backend_api/Option.html @@ -28,7 +28,7 @@
-

Option(name, value, isSynced, utcDateModified, utcDateCreated)

+

Option()

Option represents name-value pair, either directly configurable by the user or some system property.
@@ -45,7 +45,7 @@ -

new Option(name, value, isSynced, utcDateModified, utcDateCreated)

+

new Option()

@@ -60,10 +60,15 @@ -
Parameters:
+ + + + +
Properties:
+ - +
@@ -203,8 +208,6 @@ - -
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html index 0e9b1b93c..756a21c9d 100644 --- a/docs/backend_api/RecentNote.html +++ b/docs/backend_api/RecentNote.html @@ -28,7 +28,7 @@
-

RecentNote(noteId, notePath, isDeleted, utcDateModified)

+

RecentNote()

RecentNote represents recently visited note.
@@ -45,7 +45,7 @@ -

new RecentNote(noteId, notePath, isDeleted, utcDateModified)

+

new RecentNote()

@@ -60,10 +60,15 @@ -
Parameters:
+ + + + +
Properties:
+ -
+
@@ -180,8 +185,6 @@ - -
diff --git a/docs/backend_api/entities_api_token.js.html b/docs/backend_api/entities_api_token.js.html index eda639384..5d835d2e3 100644 --- a/docs/backend_api/entities_api_token.js.html +++ b/docs/backend_api/entities_api_token.js.html @@ -34,10 +34,10 @@ const dateUtils = require('../services/date_utils'); /** * ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender. * - * @param {string} apiTokenId - primary key - * @param {string} token - * @param {boolean} isDeleted - true if API token is deleted - * @param {string} utcDateCreated + * @property {string} apiTokenId - primary key + * @property {string} token + * @property {boolean} isDeleted - true if API token is deleted + * @property {string} utcDateCreated * * @extends Entity */ diff --git a/docs/backend_api/entities_attribute.js.html b/docs/backend_api/entities_attribute.js.html index db22d936e..1e19b196b 100644 --- a/docs/backend_api/entities_attribute.js.html +++ b/docs/backend_api/entities_attribute.js.html @@ -36,16 +36,16 @@ const sql = require('../services/sql'); /** * Attribute is key value pair owned by a note. * - * @param {string} attributeId - * @param {string} noteId - * @param {string} type - * @param {string} name - * @param {string} value - * @param {int} position - * @param {boolean} isInheritable - * @param {boolean} isDeleted - * @param {string} utcDateCreated - * @param {string} utcDateModified + * @property {string} attributeId + * @property {string} noteId + * @property {string} type + * @property {string} name + * @property {string} value + * @property {int} position + * @property {boolean} isInheritable + * @property {boolean} isDeleted + * @property {string} utcDateCreated + * @property {string} utcDateModified * * @extends Entity */ diff --git a/docs/backend_api/entities_branch.js.html b/docs/backend_api/entities_branch.js.html index 9ae543ca5..c8c2e4866 100644 --- a/docs/backend_api/entities_branch.js.html +++ b/docs/backend_api/entities_branch.js.html @@ -37,15 +37,15 @@ const sql = require('../services/sql'); * Branch represents note's placement in the tree - it's essentially pair of noteId and parentNoteId. * Each note can have multiple (at least one) branches, meaning it can be placed into multiple places in the tree. * - * @param {string} branchId - primary key - * @param {string} noteId - * @param {string} parentNoteId - * @param {int} notePosition - * @param {string} prefix - * @param {boolean} isExpanded - * @param {boolean} isDeleted - * @param {string} utcDateModified - * @param {string} utcDateCreated + * @property {string} branchId - primary key + * @property {string} noteId + * @property {string} parentNoteId + * @property {int} notePosition + * @property {string} prefix + * @property {boolean} isExpanded + * @property {boolean} isDeleted + * @property {string} utcDateModified + * @property {string} utcDateCreated * * @extends Entity */ diff --git a/docs/backend_api/entities_note.js.html b/docs/backend_api/entities_note.js.html index 06ba0c295..a62d38017 100644 --- a/docs/backend_api/entities_note.js.html +++ b/docs/backend_api/entities_note.js.html @@ -49,6 +49,7 @@ const RELATION_DEFINITION = 'relation-definition'; * @property {string} type - one of "text", "code", "file" or "render" * @property {string} mime - MIME type, e.g. "text/html" * @property {string} title - note title + * @property {int} contentLength - length of content * @property {boolean} isProtected - true if note is protected * @property {boolean} isDeleted - true if note is deleted * @property {boolean} isErased - true if note's content is erased after it has been deleted @@ -143,6 +144,7 @@ class Note extends Entity { async setContent(content) { // force updating note itself so that dateModified is represented correctly even for the content this.forcedChange = true; + this.contentLength = content.length; await this.save(); this.content = content; @@ -754,6 +756,26 @@ class Note extends Entity { AND parent_notes.isDeleted = 0`, [this.noteId]); } + /** + * @return {Promise<string[][]>} - array of notePaths (each represented by array of noteIds constituting the particular note path) + */ + async getAllNotePaths() { + if (this.noteId === 'root') { + return [['root']]; + } + + const notePaths = []; + + for (const parentNote of await this.getParentNotes()) { + for (const parentPath of await parentNote.getAllNotePaths()) { + parentPath.push(this.noteId); + notePaths.push(parentPath); + } + } + + return notePaths; + } + beforeSaving() { if (!this.isDeleted) { this.isDeleted = false; @@ -767,6 +789,10 @@ class Note extends Entity { this.utcDateCreated = dateUtils.utcNowDateTime(); } + if (this.contentLength === undefined) { + this.contentLength = -1; + } + super.beforeSaving(); if (this.isChanged) { diff --git a/docs/backend_api/entities_note_revision.js.html b/docs/backend_api/entities_note_revision.js.html index 50f8befae..8557348d0 100644 --- a/docs/backend_api/entities_note_revision.js.html +++ b/docs/backend_api/entities_note_revision.js.html @@ -39,24 +39,26 @@ const syncTableService = require('../services/sync_table'); /** * NoteRevision represents snapshot of note's title and content at some point in the past. It's used for seamless note versioning. * - * @param {string} noteRevisionId - * @param {string} noteId - * @param {string} type - * @param {string} mime - * @param {string} title - * @param {string} isProtected - * @param {string} dateLastEdited - * @param {string} dateCreated - * @param {string} utcDateLastEdited - * @param {string} utcDateCreated - * @param {string} utcDateModified + * @property {string} noteRevisionId + * @property {string} noteId + * @property {string} type + * @property {string} mime + * @property {string} title + * @property {int} contentLength + * @property {boolean} isErased + * @property {boolean} isProtected + * @property {string} dateLastEdited + * @property {string} dateCreated + * @property {string} utcDateLastEdited + * @property {string} utcDateCreated + * @property {string} utcDateModified * * @extends Entity */ class NoteRevision extends Entity { static get entityName() { return "note_revisions"; } static get primaryKeyName() { return "noteRevisionId"; } - static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "contentLength", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } + static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "contentLength", "isErased", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } constructor(row) { super(row); @@ -130,7 +132,7 @@ class NoteRevision extends Entity { async setContent(content) { // force updating note itself so that utcDateModified is represented correctly even for the content this.forcedChange = true; - this.contentLength = content.length; + this.contentLength = content === null ? 0 : content.length; await this.save(); this.content = content; @@ -156,6 +158,14 @@ class NoteRevision extends Entity { await syncTableService.addNoteRevisionContentSync(this.noteRevisionId); } + beforeSaving() { + super.beforeSaving(); + + if (this.isChanged) { + this.utcDateModified = dateUtils.utcNowDateTime(); + } + } + // cannot be static! updatePojo(pojo) { if (pojo.isProtected) { diff --git a/docs/backend_api/entities_option.js.html b/docs/backend_api/entities_option.js.html index f9dc87bab..7b658bfdd 100644 --- a/docs/backend_api/entities_option.js.html +++ b/docs/backend_api/entities_option.js.html @@ -34,11 +34,11 @@ const dateUtils = require('../services/date_utils'); /** * Option represents name-value pair, either directly configurable by the user or some system property. * - * @param {string} name - * @param {string} value - * @param {boolean} isSynced - * @param {string} utcDateModified - * @param {string} utcDateCreated + * @property {string} name + * @property {string} value + * @property {boolean} isSynced + * @property {string} utcDateModified + * @property {string} utcDateCreated * * @extends Entity */ diff --git a/docs/backend_api/entities_recent_note.js.html b/docs/backend_api/entities_recent_note.js.html index 531d0482c..b820fdced 100644 --- a/docs/backend_api/entities_recent_note.js.html +++ b/docs/backend_api/entities_recent_note.js.html @@ -34,10 +34,10 @@ const dateUtils = require('../services/date_utils'); /** * RecentNote represents recently visited note. * - * @param {string} noteId - * @param {string} notePath - * @param {boolean} isDeleted - * @param {string} utcDateModified + * @property {string} noteId + * @property {string} notePath + * @property {boolean} isDeleted + * @property {string} utcDateModified * * @extends Entity */ diff --git a/docs/frontend_api/NoteShort.html b/docs/frontend_api/NoteShort.html index 1823f4bfc..6e3561286 100644 --- a/docs/frontend_api/NoteShort.html +++ b/docs/frontend_api/NoteShort.html @@ -278,7 +278,7 @@
Source:
@@ -346,7 +346,7 @@
Source:
@@ -414,7 +414,7 @@
Source:
@@ -432,123 +432,7 @@ -

cssClass

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

isDeleted

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

isProtected

+

contentLength

@@ -606,6 +490,238 @@ +

cssClass

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

iconClass

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isDeleted

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isProtected

+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +

mime

@@ -646,7 +762,7 @@
Source:
@@ -772,7 +888,7 @@
Source:
@@ -840,7 +956,7 @@
Source:
@@ -956,7 +1072,7 @@
Source:
@@ -1104,7 +1220,7 @@
Source:
@@ -1271,7 +1387,7 @@
Source:
@@ -1445,7 +1561,7 @@
Source:
@@ -1551,7 +1667,7 @@
Source:
@@ -1653,7 +1769,7 @@
Source:
@@ -1755,7 +1871,7 @@
Source:
@@ -1857,7 +1973,7 @@
Source:
@@ -2008,7 +2124,7 @@
Source:
@@ -2175,7 +2291,7 @@
Source:
@@ -2342,7 +2458,7 @@
Source:
@@ -2497,7 +2613,7 @@
Source:
@@ -2603,7 +2719,7 @@
Source:
@@ -2705,7 +2821,7 @@
Source:
@@ -2856,7 +2972,7 @@
Source:
@@ -3023,7 +3139,7 @@
Source:
@@ -3190,7 +3306,7 @@
Source:
@@ -3345,7 +3461,7 @@
Source:
@@ -3515,7 +3631,7 @@
Source:
@@ -3666,7 +3782,7 @@
Source:
@@ -3776,7 +3892,7 @@
Source:
@@ -3950,7 +4066,7 @@
Source:
@@ -4056,7 +4172,7 @@
Source:
@@ -4207,7 +4323,7 @@
Source:
@@ -4362,7 +4478,7 @@
Source:
@@ -4473,7 +4589,7 @@ Cache is note instance scoped.
Source:
@@ -4557,7 +4673,7 @@ Cache is note instance scoped.
Source:
diff --git a/docs/frontend_api/entities_note_short.js.html b/docs/frontend_api/entities_note_short.js.html index dd056d723..ed9603318 100644 --- a/docs/frontend_api/entities_note_short.js.html +++ b/docs/frontend_api/entities_note_short.js.html @@ -49,6 +49,8 @@ class NoteShort { this.noteId = row.noteId; /** @param {string} */ this.title = row.title; + /** @param {int} */ + this.contentLength = row.contentLength; /** @param {boolean} */ this.isProtected = row.isProtected; /** @param {string} one of 'text', 'code', 'file' or 'render' */ @@ -61,6 +63,8 @@ class NoteShort { this.archived = row.archived; /** @param {string} */ this.cssClass = row.cssClass; + /** @param {string} */ + this.iconClass = row.iconClass; /** @type {string[]} */ this.parents = []; diff --git a/docs/frontend_api/services_frontend_script_api.js.html b/docs/frontend_api/services_frontend_script_api.js.html index e97f6466a..e76325720 100644 --- a/docs/frontend_api/services_frontend_script_api.js.html +++ b/docs/frontend_api/services_frontend_script_api.js.html @@ -115,7 +115,7 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, tabConte const button = $('<button>') .addClass("btn btn-sm") - .click(opts.action); + .on('click', opts.action); if (opts.icon) { button.append($("<span>").addClass("bx bx-" + opts.icon)) diff --git a/src/entities/note.js b/src/entities/note.js index 60b603cf2..7e0e544f1 100644 --- a/src/entities/note.js +++ b/src/entities/note.js @@ -728,6 +728,26 @@ class Note extends Entity { AND parent_notes.isDeleted = 0`, [this.noteId]); } + /** + * @return {Promise} - array of notePaths (each represented by array of noteIds constituting the particular note path) + */ + async getAllNotePaths() { + if (this.noteId === 'root') { + return [['root']]; + } + + const notePaths = []; + + for (const parentNote of await this.getParentNotes()) { + for (const parentPath of await parentNote.getAllNotePaths()) { + parentPath.push(this.noteId); + notePaths.push(parentPath); + } + } + + return notePaths; + } + beforeSaving() { if (!this.isDeleted) { this.isDeleted = false; diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index 7d0d942c7..5c41515da 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -4,7 +4,6 @@ import server from './server.js'; import ws from "./ws.js"; import treeCache from "./tree_cache.js"; import NoteFull from "../entities/note_full.js"; -import bundleService from "./bundle.js"; import utils from "./utils.js"; import contextMenuService from "./context_menu.js"; import treeUtils from "./tree_utils.js"; diff --git a/src/public/javascripts/services/tree_cache.js b/src/public/javascripts/services/tree_cache.js index 02bfcbfe4..e3d1cf350 100644 --- a/src/public/javascripts/services/tree_cache.js +++ b/src/public/javascripts/services/tree_cache.js @@ -107,6 +107,10 @@ class TreeCache { if (note.type === 'search') { const searchResults = await server.get('search-note/' + note.noteId); + if (!searchResults) { + throw new Error(`Search note ${note.noteId} failed.`); + } + // force to load all the notes at once instead of one by one await treeCache.getNotes(searchResults.map(res => res.noteId));