fix NoteLink component is unable to display path for root note (#7736)

This commit is contained in:
Elian Doran 2025-11-14 17:38:19 +02:00 committed by GitHub
commit 9b1b56a381
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,11 +150,16 @@ async function createLink(notePath: string | undefined, options: CreateLinkOptio
$container.append($noteLink);
if (showNotePath) {
let pathSegments: string[];
if (notePath == "root") {
pathSegments = ["⌂"];
} else {
const resolvedPathSegments = (await treeService.resolveNotePathToSegments(notePath)) || [];
resolvedPathSegments.pop(); // Remove last element
const resolvedPath = resolvedPathSegments.join("/");
const pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
}
if (pathSegments) {
if (pathSegments.length) {