Skip to content

Commit 9b1b56a

Browse files
authored
fix NoteLink component is unable to display path for root note (#7736)
2 parents e6810ef + 0285903 commit 9b1b56a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

apps/client/src/services/link.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,16 @@ async function createLink(notePath: string | undefined, options: CreateLinkOptio
150150
$container.append($noteLink);
151151

152152
if (showNotePath) {
153-
const resolvedPathSegments = (await treeService.resolveNotePathToSegments(notePath)) || [];
154-
resolvedPathSegments.pop(); // Remove last element
155-
156-
const resolvedPath = resolvedPathSegments.join("/");
157-
const pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
153+
let pathSegments: string[];
154+
if (notePath == "root") {
155+
pathSegments = ["⌂"];
156+
} else {
157+
const resolvedPathSegments = (await treeService.resolveNotePathToSegments(notePath)) || [];
158+
resolvedPathSegments.pop(); // Remove last element
159+
160+
const resolvedPath = resolvedPathSegments.join("/");
161+
pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
162+
}
158163

159164
if (pathSegments) {
160165
if (pathSegments.length) {

0 commit comments

Comments
 (0)