save editedSha in cached note to remember even after navigations
This commit is contained in:
5
src/modules/note/cache/prepareNoteCache.ts
vendored
5
src/modules/note/cache/prepareNoteCache.ts
vendored
@@ -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)
|
||||
|
||||
@@ -3,4 +3,5 @@ import { Model } from '@/data/models/Model'
|
||||
|
||||
export interface Note extends Model<DataType.Note> {
|
||||
content: string
|
||||
editedSha?: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user