File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
client/src/widgets/dialogs Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ import { useTriliumEvent } from "../react/hooks.jsx";
1212import FBranch from "../../entities/fbranch.js" ;
1313import type { ContextMenuCommandData } from "../../components/app_context.js" ;
1414
15+ // Virtual branches (e.g., from search results) start with this prefix
16+ const VIRTUAL_BRANCH_PREFIX = "virt-" ;
17+
1518export default function BranchPrefixDialog ( ) {
1619 const [ shown , setShown ] = useState ( false ) ;
1720 const [ branches , setBranches ] = useState < FBranch [ ] > ( [ ] ) ;
@@ -23,7 +26,7 @@ export default function BranchPrefixDialog() {
2326
2427 if ( data ?. selectedOrActiveBranchIds && data . selectedOrActiveBranchIds . length > 0 ) {
2528 // Multi-select mode from tree context menu
26- branchIds = data . selectedOrActiveBranchIds . filter ( ( branchId ) => ! branchId . startsWith ( "virt-" ) ) ;
29+ branchIds = data . selectedOrActiveBranchIds . filter ( ( branchId ) => ! branchId . startsWith ( VIRTUAL_BRANCH_PREFIX ) ) ;
2730 } else {
2831 // Single branch mode from keyboard shortcut or when no selection
2932 const notePath = appContext . tabManager . getActiveContextNotePath ( ) ;
Original file line number Diff line number Diff line change @@ -278,18 +278,22 @@ function setPrefixBatch(req: Request) {
278278 }
279279
280280 const normalizedPrefix = utils . isEmptyOrWhitespace ( prefix ) ? null : prefix ;
281+ let updatedCount = 0 ;
281282
282283 for ( const branchId of branchIds ) {
283284 const branch = becca . getBranch ( branchId ) ;
284285 if ( branch ) {
285286 branch . prefix = normalizedPrefix ;
286287 branch . save ( ) ;
288+ updatedCount ++ ;
289+ } else {
290+ log . info ( `Branch ${ branchId } not found, skipping prefix update` ) ;
287291 }
288292 }
289293
290294 return {
291295 success : true ,
292- count : branchIds . length
296+ count : updatedCount
293297 } ;
294298}
295299
You can’t perform that action at this time.
0 commit comments