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.
This commit is contained in:
@@ -239,6 +239,25 @@ const onConflictOverwrite = async () => {
|
|||||||
const onConflictCancel = () => {
|
const onConflictCancel = () => {
|
||||||
if (mode.value === "read") toggleMode()
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -270,7 +289,7 @@ const onConflictCancel = () => {
|
|||||||
<note-freshness-badge
|
<note-freshness-badge
|
||||||
:status="freshnessStatus"
|
:status="freshnessStatus"
|
||||||
:last-checked-at="lastCheckedAt"
|
:last-checked-at="lastCheckedAt"
|
||||||
@click="checkFreshness"
|
@click="onBadgeClick"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
v-if="isMarkdown"
|
v-if="isMarkdown"
|
||||||
|
|||||||
Reference in New Issue
Block a user