Skip to content

Build your personal knowledge base with Trilium Notes

small fixes

zadam1e8472266f16
diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.js
index 2daa21b256..dd0152745f 100644
--- a/src/public/app/services/entrypoints.js
+++ b/src/public/app/services/entrypoints.js
@@ -213,9 +213,13 @@ export default class Entrypoints extends Component {
} else if (note.mime.endsWith("env=backend")) {
await server.post('script/run/' + note.noteId);
} else if (note.mime === 'text/x-sqlite;schema=trilium') {
- const {results} = await server.post("sql/execute/" + note.noteId);
+ const resp = await server.post("sql/execute/" + note.noteId);
- await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: results});
+ if (!resp.success) {
+ alert("Error occurred while executing SQL query: " + resp.message);
+ }
+
+ await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: resp.results});
}
toastService.showMessage("Note executed");
diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.js
index 7bed9a7a98..e1ea8f24ae 100644
--- a/src/public/app/services/tree.js
+++ b/src/public/app/services/tree.js
@@ -83,6 +83,10 @@ async function resolveNotePathToSegments(notePath, hoistedNoteId = 'root', logEr
if (someNotePath) { // in case it's root the path may be empty
const pathToRoot = someNotePath.split("/").reverse().slice(1);
+ if (!pathToRoot.includes("root")) {
+ pathToRoot.push('root');
+ }
+
for (const noteId of pathToRoot) {
effectivePathSegments.push(noteId);
}
diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.js
index f12f930e33..2869c0390f 100644
--- a/src/services/consistency_checks.js
+++ b/src/services/consistency_checks.js
@@ -258,7 +258,8 @@ class ConsistencyChecks {
FROM branches
WHERE noteId = ?
and parentNoteId = ?
- and isDeleted = 0`, [noteId, parentNoteId]);
+ and isDeleted = 0
+ ORDER BY utcDateCreated`, [noteId, parentNoteId]);
const branches = branchIds.map(branchId => becca.getBranch(branchId));
diff --git a/src/services/special_notes.js b/src/services/special_notes.js
index 9c27f7f14a..41c2f99e7f 100644
--- a/src/services/special_notes.js
+++ b/src/services/special_notes.js
@@ -34,6 +34,7 @@ function getHiddenRoot() {
if (!hidden) {
hidden = noteService.createNewNote({
+ branchId: 'hidden',
noteId: 'hidden',
title: 'hidden',
type: 'text',