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

@@ -6,11 +6,12 @@ export const prepareNoteCache = (sha: string) => {
const noteId = data.generateId(DataType.Note, sha)
const getCachedNote = async () => data.get<DataType.Note, Note>(noteId)
const saveCacheNote = async (content: string) => {
const saveCacheNote = async (content: string, editedSha?: string) => {
const newNote: Note = {
_id: noteId,
$type: DataType.Note,
content
content,
editedSha
}
await data.update(newNote)

View File

@@ -3,4 +3,5 @@ import { Model } from '@/data/models/Model'
export interface Note extends Model<DataType.Note> {
content: string
editedSha?: string
}