mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 08:21:39 -06:00
fix: smooth book navigation by preventing view remount on bookId change
This commit is contained in:
@@ -10,6 +10,9 @@ const route = useRoute()
|
||||
const themeStore = useThemeStore()
|
||||
|
||||
const backgroundClass = computed(() => BACKGROUND_OPTIONS.find((b) => b.id === themeStore.background)?.cssClass ?? '')
|
||||
|
||||
const BOOK_ROUTE_NAMES = new Set(['book-detail', 'book-edit', 'book-files'])
|
||||
const viewKey = computed(() => (BOOK_ROUTE_NAMES.has(String(route.name)) ? String(route.name) : route.path))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -21,7 +24,7 @@ const backgroundClass = computed(() => BACKGROUND_OPTIONS.find((b) => b.id === t
|
||||
|
||||
<!-- 2. Independent View Area: Everything below the header scrolls here -->
|
||||
<div class="px-4 pt-2 flex-1 overflow-y-auto overflow-x-hidden relative scroll-smooth bg-transparent">
|
||||
<router-view :key="route.path" />
|
||||
<router-view :key="viewKey" />
|
||||
<!-- Bottom gutter matching the top floating margin -->
|
||||
<div class="h-6 w-full" />
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,6 @@ export function useBookDetail() {
|
||||
async function fetch(bookId: number) {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
detail.value = null
|
||||
try {
|
||||
const res = await api(`/api/v1/books/${bookId}`)
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||
|
||||
Reference in New Issue
Block a user