From ec22fd9e996b1b2f7cfd1dfead4c85fbc9f6aeeb Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 16 Dec 2025 10:56:00 +0200 Subject: [PATCH] refactor(breadcrumb): use existing function to parse note path --- apps/client/src/widgets/layout/Breadcrumb.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/layout/Breadcrumb.tsx b/apps/client/src/widgets/layout/Breadcrumb.tsx index 67775177e..a836f8a5f 100644 --- a/apps/client/src/widgets/layout/Breadcrumb.tsx +++ b/apps/client/src/widgets/layout/Breadcrumb.tsx @@ -19,6 +19,7 @@ import froca from "../../services/froca"; import hoisted_note from "../../services/hoisted_note"; import { t } from "../../services/i18n"; import note_create from "../../services/note_create"; +import tree from "../../services/tree"; import ActionButton from "../react/ActionButton"; import { Badge } from "../react/Badge"; import Dropdown from "../react/Dropdown"; @@ -268,9 +269,7 @@ function buildContextMenu(notePath: string, parentComponent: Component | null) { return async (e: MouseEvent) => { e.preventDefault(); - const notePathComponents = notePath.split("/"); - const parentNoteId = notePathComponents.at(-2); - const noteId = notePathComponents.at(-1); + const { noteId, parentNoteId } = tree.getNoteIdAndParentIdFromUrl(notePath); if (!parentNoteId || !noteId) return; const branchId = await froca.getBranchId(parentNoteId, noteId);