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
Address code review feedback - add logging and constant for virtual branches
copilot-swe-agent[bot]5b8bb8587d85
diff --git a/apps/client/src/widgets/dialogs/branch_prefix.tsx b/apps/client/src/widgets/dialogs/branch_prefix.tsxindex 4a1c025b0f..26f6f0dff1 100644--- a/apps/client/src/widgets/dialogs/branch_prefix.tsx+++ b/apps/client/src/widgets/dialogs/branch_prefix.tsx@@ -12,6 +12,9 @@ import { useTriliumEvent } from "../react/hooks.jsx";import FBranch from "../../entities/fbranch.js";import type { ContextMenuCommandData } from "../../components/app_context.js";+// Virtual branches (e.g., from search results) start with this prefix+const VIRTUAL_BRANCH_PREFIX = "virt-";+export default function BranchPrefixDialog() {const [ shown, setShown ] = useState(false);const [ branches, setBranches ] = useState<FBranch[]>([]);@@ -23,7 +26,7 @@ export default function BranchPrefixDialog() {if (data?.selectedOrActiveBranchIds && data.selectedOrActiveBranchIds.length > 0) {// Multi-select mode from tree context menu- branchIds = data.selectedOrActiveBranchIds.filter((branchId) => !branchId.startsWith("virt-"));+ branchIds = data.selectedOrActiveBranchIds.filter((branchId) => !branchId.startsWith(VIRTUAL_BRANCH_PREFIX));} else {// Single branch mode from keyboard shortcut or when no selectionconst notePath = appContext.tabManager.getActiveContextNotePath();diff --git a/apps/server/src/routes/api/branches.ts b/apps/server/src/routes/api/branches.tsindex 86699f5ba9..977fd34a7d 100644--- a/apps/server/src/routes/api/branches.ts+++ b/apps/server/src/routes/api/branches.ts@@ -278,18 +278,22 @@ function setPrefixBatch(req: Request) {}const normalizedPrefix = utils.isEmptyOrWhitespace(prefix) ? null : prefix;+ let updatedCount = 0;for (const branchId of branchIds) {const branch = becca.getBranch(branchId);if (branch) {branch.prefix = normalizedPrefix;branch.save();+ updatedCount++;+ } else {+ log.info(`Branch ${branchId} not found, skipping prefix update`);}}return {success: true,- count: branchIds.length+ count: updatedCount};}