From 5ae0a5cf1eda6ae86a45fb70cb2540c1bd0136c3 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 23 Dec 2022 21:13:00 +0100 Subject: [PATCH] randomize existing fixed branchIds so it's clear they should not be relied upon --- src/becca/entities/branch.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/becca/entities/branch.js b/src/becca/entities/branch.js index c1744c90d..f3640e7be 100644 --- a/src/becca/entities/branch.js +++ b/src/becca/entities/branch.js @@ -12,6 +12,9 @@ const log = require("../../services/log"); * Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple * parents. * + * Note that you should not rely on the branch's identity, since it can change easily with a note's move. + * Always check noteId instead. + * * @extends AbstractEntity */ class Branch extends AbstractEntity { @@ -210,7 +213,7 @@ class Branch extends AbstractEntity { let maxNotePos = 0; for (const childBranch of this.parentNote.getChildBranches()) { - if (maxNotePos < childBranch.notePosition && childBranch.branchId !== '_hidden') { + if (maxNotePos < childBranch.notePosition && childBranch.noteId !== '_hidden') { maxNotePos = childBranch.notePosition; } }