From 002cf9a4b1bdd833c5435eb0e26e6d248025026c Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sun, 3 May 2026 23:37:28 +0200 Subject: [PATCH] fix(stacked-note): act on outdated badge clicks Clicking the badge while it shows outdated now pulls the latest version from GitHub when there are no unsaved edits, or opens the conflict modal when edits are in flight. Previously the click only re-ran the same freshness check, so the badge appeared dead. --- src/components/StackedNote.vue | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/StackedNote.vue b/src/components/StackedNote.vue index dd1864c..c3a256d 100644 --- a/src/components/StackedNote.vue +++ b/src/components/StackedNote.vue @@ -239,6 +239,25 @@ const onConflictOverwrite = async () => { const onConflictCancel = () => { if (mode.value === "read") toggleMode() } + +const onBadgeClick = async () => { + if (freshnessStatus.value !== "outdated") { + await checkFreshness() + return + } + + const hasUnsavedEdits = rawContent.value !== initialRawContent.value + if (hasUnsavedEdits) { + conflictOpen.value = true + return + } + + const newRaw = await pullLatest() + if (newRaw !== null) { + rawContent.value = newRaw + initialRawContent.value = newRaw + } +}