From d4eb45d6e195d920bb44ae6427ca758a3341fdfd Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sat, 27 Sep 2025 21:19:17 +0200 Subject: [PATCH] feat: add a error message when note is not found with the absolute path for better debugging. --- src/components/FluxNote.vue | 1 - src/hooks/useNoteView.hook.ts | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/FluxNote.vue b/src/components/FluxNote.vue index be8a53c..504cf4f 100644 --- a/src/components/FluxNote.vue +++ b/src/components/FluxNote.vue @@ -42,7 +42,6 @@ const props = withDefaults( }, ) -const route = useRoute() const user = computed(() => props.user) const repo = computed(() => props.repo) diff --git a/src/hooks/useNoteView.hook.ts b/src/hooks/useNoteView.hook.ts index 13f0409..755c023 100644 --- a/src/hooks/useNoteView.hook.ts +++ b/src/hooks/useNoteView.hook.ts @@ -7,6 +7,7 @@ import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hoo import { resolvePath } from "@/modules/repo/services/resolvePath" import { useUserRepoStore } from "@/modules/repo/store/userRepo.store" import { pathToNotePathTitle } from "@/utils/noteTitle" +import { errorMessage } from "@/utils/notif" export const useNoteView = (containerClass: string) => { const store = useUserRepoStore() @@ -32,10 +33,11 @@ export const useNoteView = (containerClass: string) => { (file) => file.sha === currentNoteSHA, ) - const finalPath = resolvePath(currentFile?.path ?? "", path) + const absolutePath = resolvePath(currentFile?.path ?? "", path) - const file = store.files.find((file) => file.path === finalPath) + const file = store.files.find((file) => file.path === absolutePath) if (!file?.sha) { + errorMessage(`Note ${absolutePath} not found.`) return }