Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix setNoteToParent API breakage, closes #4505
zadam0ac397e7ffbc
diff --git a/src/services/tree.js b/src/services/tree.jsindex 60f481d554..66276ab2f0 100644--- a/src/services/tree.js+++ b/src/services/tree.js@@ -209,8 +209,9 @@ function sortNotesIfNeeded(parentNoteId) {function setNoteToParent(noteId, prefix, parentNoteId) {const parentNote = becca.getNote(parentNoteId);- if (!parentNote) {- throw new Error(`Cannot move note to deleted parent note '${parentNoteId}'`);+ if (parentNoteId && !parentNote) {+ // null parentNoteId is a valid value+ throw new Error(`Cannot move note to deleted / missing parent note '${parentNoteId}'`);}// case where there might be more such branches is ignored. It's expected there should be just one