feat: add a error message when note is not found with the absolute path for better debugging.

This commit is contained in:
Julien Calixte
2025-09-27 21:19:17 +02:00
parent b62a0e143d
commit d4eb45d6e1
2 changed files with 4 additions and 3 deletions

View File

@@ -42,7 +42,6 @@ const props = withDefaults(
}, },
) )
const route = useRoute()
const user = computed(() => props.user) const user = computed(() => props.user)
const repo = computed(() => props.repo) const repo = computed(() => props.repo)

View File

@@ -7,6 +7,7 @@ import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hoo
import { resolvePath } from "@/modules/repo/services/resolvePath" import { resolvePath } from "@/modules/repo/services/resolvePath"
import { useUserRepoStore } from "@/modules/repo/store/userRepo.store" import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
import { pathToNotePathTitle } from "@/utils/noteTitle" import { pathToNotePathTitle } from "@/utils/noteTitle"
import { errorMessage } from "@/utils/notif"
export const useNoteView = (containerClass: string) => { export const useNoteView = (containerClass: string) => {
const store = useUserRepoStore() const store = useUserRepoStore()
@@ -32,10 +33,11 @@ export const useNoteView = (containerClass: string) => {
(file) => file.sha === currentNoteSHA, (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) { if (!file?.sha) {
errorMessage(`Note ${absolutePath} not found.`)
return return
} }