Skip to content

Commit

Permalink
fix setNoteToParent API breakage, closes #4505
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Dec 11, 2023
1 parent d243880 commit 0ac397e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/services/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0ac397e

Please sign in to comment.