save editedSha in cached note to remember even after navigations

This commit is contained in:
Julien Calixte
2023-09-06 22:49:44 +02:00
parent 746082c688
commit 2f6e8e7ca8
6 changed files with 29 additions and 9 deletions

View File

@@ -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
}