save editedSha in cached note to remember even after navigations
This commit is contained in:
@@ -17,7 +17,7 @@ const isMarkdown = (filename?: string) => filename?.endsWith('.md') ?? false
|
||||
export const useComputeBacklinks = () => {
|
||||
const store = useUserRepoStore()
|
||||
|
||||
watch(store, async () => {
|
||||
watch(store,async () => {
|
||||
if (!store.userSettings?.backlink) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -26,6 +26,16 @@ export const useFile = (sha: Ref<string> | string, retrieveContent = true) => {
|
||||
rawContent.value ? renderFromUTF8(rawContent.value) : ''
|
||||
)
|
||||
|
||||
const getEditedSha = async () => {
|
||||
const note = await getCachedNote()
|
||||
|
||||
if (!note) {
|
||||
return null
|
||||
}
|
||||
|
||||
return note.editedSha ?? null
|
||||
}
|
||||
|
||||
const getCachedFileContent = async (): Promise<string | null> => {
|
||||
const cachedNote = await getCachedNote()
|
||||
|
||||
@@ -86,6 +96,7 @@ export const useFile = (sha: Ref<string> | string, retrieveContent = true) => {
|
||||
getRawContent,
|
||||
getContent,
|
||||
getCachedFileContent,
|
||||
getEditedSha,
|
||||
fromCache,
|
||||
saveCacheNote
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export const useGitHubContent = ({
|
||||
|
||||
return response?.data.content?.sha ?? null
|
||||
} catch (error) {
|
||||
errorMessage('File could not be saved')
|
||||
errorMessage('Note could not be saved')
|
||||
}
|
||||
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user