fix: prefer fallback for back button most of the time

This commit is contained in:
Julien Calixte
2026-02-15 21:18:44 +01:00
parent 1c3120e4f7
commit 28a2bd8e31
2 changed files with 13 additions and 2 deletions

View File

@@ -1,10 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRouter, type RouteLocationRaw } from "vue-router" import { useRouter, type RouteLocationRaw } from "vue-router"
const props = defineProps<{ fallback?: RouteLocationRaw }>() const props = withDefaults(
defineProps<{ fallback?: RouteLocationRaw; preferFallback?: boolean }>(),
{ preferFallback: true },
)
const router = useRouter() const router = useRouter()
const goBack = () => { const goBack = () => {
if (props.preferFallback && props.fallback) {
router.push(props.fallback)
return
}
if (window.history.state?.back) { if (window.history.state?.back) {
router.back() router.back()
} else if (props.fallback) { } else if (props.fallback) {

View File

@@ -99,7 +99,10 @@ watch(
</span> </span>
<article class="note-display" v-html="content"></article> <article class="note-display" v-html="content"></article>
<BackButton :fallback="{ name: 'PublicNoteListByDidView', params: { did } }" /> <back-button
:fallback="{ name: 'PublicNoteListByDidView', params: { did } }"
:prefer-fallback="false"
/>
</div> </div>
<stacked-public-note <stacked-public-note
v-for="(stackedNote, index) in stackedNotes" v-for="(stackedNote, index) in stackedNotes"