Skip to content

Commit 0ac397e

Browse files
committed
fix setNoteToParent API breakage, closes #4505
1 parent d243880 commit 0ac397e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/services/tree.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ function sortNotesIfNeeded(parentNoteId) {
209209
function setNoteToParent(noteId, prefix, parentNoteId) {
210210
const parentNote = becca.getNote(parentNoteId);
211211

212-
if (!parentNote) {
213-
throw new Error(`Cannot move note to deleted parent note '${parentNoteId}'`);
212+
if (parentNoteId && !parentNote) {
213+
// null parentNoteId is a valid value
214+
throw new Error(`Cannot move note to deleted / missing parent note '${parentNoteId}'`);
214215
}
215216

216217
// case where there might be more such branches is ignored. It's expected there should be just one

0 commit comments

Comments
 (0)