From 9d27aa024f51b98ed3c8dffade41c576b449e68f Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Mon, 29 Jun 2026 01:04:51 +0200 Subject: [PATCH] feat(notes): banner when viewing an older shared version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cache the note path on each snapshot so an old shared sha can find its current version, and show a calm "older shared version — View latest" banner. The exact snapshot is shown as-is; the banner only offers a jump to the latest, never swapping content. --- src/components/StackedNote.vue | 37 ++++++++++++++++++++++ src/hooks/useFile.hook.ts | 14 ++++++++ src/modules/note/cache/prepareNoteCache.ts | 6 ++-- src/modules/note/models/Note.ts | 3 ++ src/modules/note/snapshotStatus.spec.ts | 23 ++++++++++++++ src/modules/note/snapshotStatus.ts | 25 +++++++++++++++ 6 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 src/modules/note/snapshotStatus.spec.ts create mode 100644 src/modules/note/snapshotStatus.ts diff --git a/src/components/StackedNote.vue b/src/components/StackedNote.vue index 5948415..85d4e82 100644 --- a/src/components/StackedNote.vue +++ b/src/components/StackedNote.vue @@ -68,12 +68,17 @@ const advanceStackTo = (newSha: string | null) => { const { path, + newerSha, content, rawContent, getRawContent, saveCacheNote, getEditedSha } = useFile(sha) + +// When this is an older snapshot of a still-existing note, jump the stack to +// its current version (the exact snapshot is never swapped underneath you). +const viewLatest = () => advanceStackTo(newerSha.value) const initialRawContent = ref(null) const isMarkdown = computed(() => path.value ? isMarkdownPath(path.value) : true @@ -438,6 +443,16 @@ const onBadgeClick = async () => {