feat: add a error message when note is not found with the absolute path for better debugging.
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user